Fix the amixer scontrols parser in config_mixer
[grml-autoconfig.git] / tests / test_bootparameters.sh
1 #!/bin/zsh
2
3
4 test_checkbootparam() {
5     CMDLINE='foo=dingens bar foobar=blub'
6
7     checkbootparam foobar
8     retval=$?
9     assertEquals 'wrong retval for bootparam foobar' 0 ${retval}
10
11     checkbootparam bar
12     retval=$?
13     assertEquals 'wrong retval for bootparam bar' 0 ${retval}
14
15     checkbootparam foo
16     retval=$?
17     assertEquals 'wrong retval for bootparam foo' 0 ${retval}
18
19     checkbootparam dingens
20     retval=$?
21     assertEquals 'wrong retval for non-existing bootparam dingens' 1 ${retval}
22
23     checkbootparam oops
24     retval=$?
25     assertEquals 'wrong retval for non-existing bootparam oops' 1 ${retval}
26 }
27
28 test_getbootparam() {
29     CMDLINE='test=dingens tester foo=dingens foobar=blub'
30
31     value=$(getbootparam foobar)
32     retval=$?
33     assertEquals 'unexpected value for botparam foobar' 'blub' ${value}
34     assertEquals 'unexpected retval' '0' ${retval}
35
36     value=$(getbootparam foo)
37     retval=$?
38     assertEquals 'unexpected value for bootparam foo' 'dingens' ${value}
39     assertEquals 'unexpected retval' 0 ${retval}
40
41     value=$(getbootparam test)
42     retval=$?
43     assertEquals 'unexpected value for bootparam test' 'dingens' ${value}
44     assertEquals 'unexpected retval' 0 ${retval}
45
46     value=$(getbootparam tester)
47     retval=$?
48     assertTrue 'expected empty string' "[ -z ${value} ]"
49     assertEquals 'unexpected retval' 1 ${retval}
50 }
51
52
53 . ./common_tests $0