@@ -2,42 +2,127 @@ local bob = require('bob')
2
2
3
3
describe (' bob' , function ()
4
4
it (' stating something' , function ()
5
- local result = bob .hey (' Tom-ay-to, tom-aaaah-to.' )
6
- assert .are .equals (' Whatever' , result )
5
+ local result = bob .hey (" Tom-ay-to, tom-aaaah-to." )
6
+ assert .are .equals (" Whatever. " , result )
7
7
end )
8
8
9
9
it (' shouting' , function ()
10
- local result = bob .hey (' WATCH OUT!' )
11
- assert .are .equals (' Whoa, chill out!' , result )
10
+ local result = bob .hey (" WATCH OUT!" )
11
+ assert .are .equals (" Whoa, chill out!" , result )
12
+ end )
13
+
14
+ it (' shouting gibberish' , function ()
15
+ local result = bob .hey (" FCECDFCAAB" )
16
+ assert .are .equals (" Whoa, chill out!" , result )
12
17
end )
13
18
14
19
it (' asking a question' , function ()
15
- local result = bob .hey (' Does this cryogenic chamber make me look fat?' )
16
- assert .are .equals (' Sure' , result )
20
+ local result = bob .hey (" Does this cryogenic chamber make me look fat?" )
21
+ assert .are .equals (" Sure." , result )
22
+ end )
23
+
24
+ it (' asking a numeric question' , function ()
25
+ local result = bob .hey (" You are, what, like 15?" )
26
+ assert .are .equals (" Sure." , result )
27
+ end )
28
+
29
+ it (' asking gibberish' , function ()
30
+ local result = bob .hey (" fffbbcbeab?" )
31
+ assert .are .equals (" Sure." , result )
17
32
end )
18
33
19
34
it (' talking forcefully' , function ()
20
- local result = bob .hey (" Let's go make out behind the gym!" )
21
- assert .are .equals (' Whatever' , result )
35
+ local result = bob .hey (" Hi there!" )
36
+ assert .are .equals (" Whatever." , result )
37
+ end )
38
+
39
+ it (' using acronyms in regular speech' , function ()
40
+ local result = bob .hey (" It's OK if you don't want to go work for NASA." )
41
+ assert .are .equals (" Whatever." , result )
42
+ end )
43
+
44
+ it (' forceful question' , function ()
45
+ local result = bob .hey (" WHAT'S GOING ON?" )
46
+ assert .are .equals (" Calm down, I know what I'm doing!" , result )
22
47
end )
23
48
24
49
it (' shouting numbers' , function ()
25
- local result = bob .hey (' 1, 2, 3 GO!' )
26
- assert .are .equals (' Whoa, chill out!' , result )
50
+ local result = bob .hey (" 1, 2, 3 GO!" )
51
+ assert .are .equals (" Whoa, chill out!" , result )
52
+ end )
53
+
54
+ it (' no letters' , function ()
55
+ local result = bob .hey (" 1, 2, 3" )
56
+ assert .are .equals (" Whatever." , result )
57
+ end )
58
+
59
+ it (' question with no letters' , function ()
60
+ local result = bob .hey (" 4?" )
61
+ assert .are .equals (" Sure." , result )
27
62
end )
28
63
29
64
it (' shouting with special characters' , function ()
30
- local result = bob .hey (' ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!' )
31
- assert .are .equals (' Whoa, chill out!' , result )
65
+ local result = bob .hey (" ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!" )
66
+ assert .are .equals (" Whoa, chill out!" , result )
67
+ end )
68
+
69
+ it (' shouting with no exclamation mark' , function ()
70
+ local result = bob .hey (" I HATE THE DENTIST" )
71
+ assert .are .equals (" Whoa, chill out!" , result )
72
+ end )
73
+
74
+ it (' statement containing question mark' , function ()
75
+ local result = bob .hey (" Ending with ? means a question." )
76
+ assert .are .equals (" Whatever." , result )
77
+ end )
78
+
79
+ it (' non-letters with question' , function ()
80
+ local result = bob .hey (" :) ?" )
81
+ assert .are .equals (" Sure." , result )
82
+ end )
83
+
84
+ it (' prattling on' , function ()
85
+ local result = bob .hey (" Wait! Hang on. Are you going to be OK?" )
86
+ assert .are .equals (" Sure." , result )
32
87
end )
33
88
34
89
it (' silence' , function ()
35
- local result = bob .hey (' ' )
36
- assert .are .equals (' Fine, be that way.' , result )
90
+ local result = bob .hey (" " )
91
+ assert .are .equals (" Fine. Be that way!" , result )
92
+ end )
93
+
94
+ it (' prolonged silence' , function ()
95
+ local result = bob .hey (" " )
96
+ assert .are .equals (" Fine. Be that way!" , result )
97
+ end )
98
+
99
+ it (' alternate silence' , function ()
100
+ local result = bob .hey (" \t\t\t\t\t\t\t\t\t\t " )
101
+ assert .are .equals (" Fine. Be that way!" , result )
102
+ end )
103
+
104
+ it (' starting with whitespace' , function ()
105
+ local result = bob .hey (" hmmmmmmm..." )
106
+ assert .are .equals (" Whatever." , result )
107
+ end )
108
+
109
+ it (' ending with whitespace' , function ()
110
+ local result = bob .hey (" Okay if like my spacebar quite a bit? " )
111
+ assert .are .equals (" Sure." , result )
112
+ end )
113
+
114
+ it (' other whitespace' , function ()
115
+ local result = bob .hey (" \n\r \t " )
116
+ assert .are .equals (" Fine. Be that way!" , result )
117
+ end )
118
+
119
+ it (' non-question ending with whitespace' , function ()
120
+ local result = bob .hey (" This is a statement ending with whitespace " )
121
+ assert .are .equals (" Whatever." , result )
37
122
end )
38
123
39
- it (' yelling a question' , function ()
40
- local result = bob .hey (' WHY ARE YOU THE WAY THAT YOU ARE? ' )
41
- assert .are .equals (' Calm down, I know what I \' m doing! ' , result )
124
+ it (' multiple line question' , function ()
125
+ local result = bob .hey (" \n Does this cryogenic chamber make \n me look fat? " )
126
+ assert .are .equals (" Sure. " , result )
42
127
end )
43
128
end )
0 commit comments