Skip to content

Commit

Permalink
Add exercise: hello world (JuliaLang#13)
Browse files Browse the repository at this point in the history
* Add exercise: hello world

* hello-world: Remove unicode test & improve topics
  • Loading branch information
SaschaMann authored Jan 28, 2017
1 parent 85b0b3b commit 6937095
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
"active": false,
"test_pattern": "TODO",
"exercises": [
{
"slug": "hello-world",
"difficulty": 1,
"topics": [
"strings",
"string interpolation"
]
},
{
"slug": "hamming",
"difficulty": 1,
Expand Down
3 changes: 3 additions & 0 deletions exercises/hello-world/example.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function hello(name::AbstractString="World")
return "Hello, $(name)!"
end
3 changes: 3 additions & 0 deletions exercises/hello-world/hello-world.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function hello()

end
12 changes: 12 additions & 0 deletions exercises/hello-world/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Base.Test

include("hello-world.jl")

@testset "no name" begin
@test hello() == "Hello, World!"
end

@testset "names" begin
@test hello("Alice") == "Hello, Alice!"
@test hello("Bob") == "Hello, Bob!"
end

0 comments on commit 6937095

Please sign in to comment.