Improve tests on Option<bool>.
[command.git] / tests / command / understand_bool_option.test
1 #!/bin/sh
2
3 for t in 0 1; do
4     TEST=$($srcdir/command/option_test_command bool=$t)
5     if [ ! "$TEST" = "bool: $t" ]; then
6         echo "Command should understand Option<bool>. Expecting output: 'bool: $t', got: '$TEST'. Program exited with $? code."
7         return 1;
8     fi
9 done
10
11 for t in -2 -1 2 3 4 5 15; do
12     TEST=$($srcdir/command/option_test_command bool=$t)
13     if [ ! "$?" = "1" ]; then
14         echo "Command should not understand Option<bool> if value is different than: 0 or 1. Got: '$TEST'. Program exited with $? code."
15         return 1;
16     fi
17 done
18
19 echo "Command understand Option<bool> correctly."
20
21 return 0;