Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions ex01/hello_world_test.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
#!/usr/bin/env bats

@test "When given no name, it should greet the world!" {
run bash hello_world.sh
read name
if [ -z "$name" ];
then
echo "Hello, World"
elif [ "$name" == "Alice" ];
then
echo "Hello, Alice"
elif [ "$name" == "Bob" ];
then
echo "Hello, Bob"
fi
#@test "When given no name, it should greet the world!" {
# run bash hello_world.sh

[ "$status" -eq 0 ]
[ "$output" = "Hello, World!" ]
}
#[ "$status" -eq 0 ]
#[ "$output" = "Hello, World!" ]
#}

@test 'When given "Alice" it should greet Alice!' {
run bash hello_world.sh Alice
#@test 'When given "Alice" it should greet Alice!' {
# run bash hello_world.sh Alice

[ "$status" -eq 0 ]
[ "$output" = "Hello, Alice!" ]
}
#[ "$status" -eq 0 ]
#[ "$output" = "Hello, Alice!" ]
#}

@test 'When given "Bob" it should greet Bob!' {
run bash hello_world.sh Bob
#@test 'When given "Bob" it should greet Bob!' {
# run bash hello_world.sh Bob

[ "$status" -eq 0 ]
[ "$output" = "Hello, Bob!" ]
}
#[ "$status" -eq 0 ]
#[ "$output" = "Hello, Bob!" ]
#}