Skip to content

Commit

Permalink
hello-world: Change to always expect "Hello, World!"
Browse files Browse the repository at this point in the history
  • Loading branch information
robphoenix committed Feb 21, 2017
1 parent f64f86d commit 1ad5648
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
5 changes: 2 additions & 3 deletions exercises/hello-world/example.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
local hello_world = {}

function hello_world.hello( name )
if not name or name == '' then name = 'world' end
return 'Hello, ' .. name .. '!'
function hello_world.hello()
return 'Hello, World!'
end

return hello_world
17 changes: 5 additions & 12 deletions exercises/hello-world/hello-world_spec.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
local hello_world = require('hello-world')

-- Define a module named hello-world. This module should contain a single
-- function named hello that takes no arguments and returns a string.

describe('hello-world', function()
it('says hello world with no name', function()
it('says hello world', function()
local result = hello_world.hello()
assert.are.equal('Hello, world!', result)
end)

it('says hello to Bob', function()
local result = hello_world.hello('Bob')
assert.are.equal('Hello, Bob!', result)
end)

it('says hello to Sally', function()
local result = hello_world.hello('Sally')
assert.are.equal('Hello, Sally!', result)
assert.are.equal('Hello, World!', result)
end)
end)

0 comments on commit 1ad5648

Please sign in to comment.