]>
Commit | Line | Data |
---|---|---|
1bce65c7 BC |
1 | #! @builddir@/grub-shell-tester |
2 | # | |
3 | # Copyright (C) 2010 Free Software Foundation, Inc. | |
4 | # | |
5 | # GRUB is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation, either version 3 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # GRUB is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with GRUB. If not, see <http://www.gnu.org/licenses/>. | |
17 | ||
18 | true | |
19 | echo $? | |
20 | ||
21 | ! true | |
22 | echo $? | |
23 | ||
24 | false | |
25 | echo $? | |
26 | ||
27 | ! false | |
28 | echo $? | |
29 | ||
30 | # | |
31 | # Negated forms (copied from grub_script_if.in) | |
32 | # | |
33 | ||
34 | #basic if, execute | |
35 | if ! true; then echo yes; fi | |
36 | ||
37 | #basic if, no execution | |
38 | if ! false; then echo no; fi | |
39 | ||
40 | #if else, execute if path | |
41 | if ! true; then echo yes; else echo no; fi | |
42 | ||
43 | #if else, execute else path | |
44 | if ! false; then echo no; else echo yes; fi | |
45 | ||
46 | #if elif, execute elif | |
47 | if ! false; then echo no; elif ! true; then echo yes; fi | |
48 | ||
49 | #if elif else, execute else | |
50 | if ! false; then echo no; elif ! false; then echo no; else echo yes; fi | |
51 | ||
52 | #if elif(1) elif(2), execute elif(2) | |
53 | if false; then echo no; elif ! false; then echo no; elif ! true; then echo yes; fi | |
54 | ||
55 | #if elif(1) elif(2) else, execute else | |
56 | if false; then echo no; elif false; then echo no; elif ! false; then echo no; else echo yes; fi | |
57 | ||
58 | #if {if elif else}, execute elif | |
59 | if true; then if false; then echo no; elif ! true; then echo yes; else echo no; fi; fi | |
60 | ||
61 | #if {if elif} else, execute elif. ofcourse no dangling-else problem due to "fi" | |
62 | if true; then if ! false; then echo no; elif true; then echo yes; fi; else echo no; fi |