forked from aks/bash-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-talk-utils.sh
executable file
·79 lines (68 loc) · 1.6 KB
/
test-talk-utils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
# test-talk-utils.sh
#
# Copyright 2006-2015 Alan K. Stebbens <[email protected]>
#
# Test module for talk-utils.sh
#
export PATH=.:$PATH
source talk-utils.sh
source test-utils.sh
test_01_talk_basic() {
start_test
check_output talk1 'talk "one"'
check_output talk2 'talk "two"'
check_output talk3 'talk "three"'
end_test
}
test_02_talk_advanced() {
start_test
check_output talk_w_2_args 'talk "one two three"'
check_output talk_w_2_args2 'talk one two three words'
end_test
}
test_03_talk_varying_norun_verbose_quiet() {
check_output talk_functions talk_with_varying_norun_verbose_quiet
}
talk_with_varying_norun_verbose_quiet() {
local norun verbose quiet func
for norun in '' 1 ; do
for verbose in '' 1 ; do
for quiet in '' 1 ; do
for func in vtalk votalk nrtalk nqtalk ; do
echo -n 1>&2 "norun=$norun verbose=$verbose quiet=$quiet : $func says: "
$func "There is output" || echo 1>&2 ""
done
echo 1>&2 "" # separate function test groups
done
done
done
}
test_04_talkf_basic() {
start_test
check_output talkf_basic_test
end_test
}
wordlist=( the time has come to talk of ceiling wax and cabbages and kings )
talkf_basic_test() {
local x=0
for (( x=0; x < ${#wordlist[*]}; x++ )) ; do
word=${wordlist[$x]}
talkf "The %d word is '%s'\n" $x "$word"
done
}
test_05_vtalkf_basic() {
start_test
check_output vtalkf_basic_test
end_test
}
vtalkf_basic_test() {
verobse= norun=
for verbose in '' 1 ; do
vtalkf "Verbose = %s\n" $verbose
done
}
init_tests "$@"
run_tests
summarize_tests
exit