forked from exercism/lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hello-world: Change to always expect "Hello, World!"
- Loading branch information
1 parent
f64f86d
commit 1ad5648
Showing
2 changed files
with
7 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |