|
1 | | -local BottleSong = require 'bottle-song' |
| 1 | +local BottleSong = require('bottle-song') |
2 | 2 |
|
3 | | -describe('lyrics', function() |
4 | | - describe('single verse', function() |
5 | | - it('first generic verse', function() |
6 | | - expected = table.concat({ |
7 | | - "Ten green bottles hanging on the wall,\n", |
8 | | - "Ten green bottles hanging on the wall,\n", |
9 | | - "And if one green bottle should accidentally fall,\n", |
10 | | - "There'll be nine green bottles hanging on the wall.\n" |
11 | | - }) |
12 | | - assert.equal(expected, BottleSong.recite(10, 1)) |
13 | | - end) |
| 3 | +describe('bottle-song', function() |
| 4 | + describe('verse', function() |
| 5 | + describe('single verse', function() |
| 6 | + it('first generic verse', function() |
| 7 | + local expected = table.concat({ |
| 8 | + 'Ten green bottles hanging on the wall,\n', |
| 9 | + 'Ten green bottles hanging on the wall,\n', |
| 10 | + 'And if one green bottle should accidentally fall,\n', |
| 11 | + "There'll be nine green bottles hanging on the wall.\n" |
| 12 | + }) |
| 13 | + assert.equal(expected, BottleSong.recite(10, 1)) |
| 14 | + end) |
14 | 15 |
|
15 | | - it('last generic verse', function() |
16 | | - expected = table.concat({ |
17 | | - "Three green bottles hanging on the wall,\n", |
18 | | - "Three green bottles hanging on the wall,\n", |
19 | | - "And if one green bottle should accidentally fall,\n", |
20 | | - "There'll be two green bottles hanging on the wall.\n" |
21 | | - }) |
22 | | - assert.equal(expected, BottleSong.recite(3, 1)) |
23 | | - end) |
| 16 | + it('last generic verse', function() |
| 17 | + local expected = table.concat({ |
| 18 | + 'Three green bottles hanging on the wall,\n', |
| 19 | + 'Three green bottles hanging on the wall,\n', |
| 20 | + 'And if one green bottle should accidentally fall,\n', |
| 21 | + "There'll be two green bottles hanging on the wall.\n" |
| 22 | + }) |
| 23 | + assert.equal(expected, BottleSong.recite(3, 1)) |
| 24 | + end) |
24 | 25 |
|
25 | | - it('verse with 2 bottles', function() |
26 | | - expected = table.concat({ |
27 | | - "Two green bottles hanging on the wall,\n", |
28 | | - "Two green bottles hanging on the wall,\n", |
29 | | - "And if one green bottle should accidentally fall,\n", |
30 | | - "There'll be one green bottle hanging on the wall.\n" |
31 | | - }) |
32 | | - assert.equal(expected, BottleSong.recite(2, 1)) |
33 | | - end) |
| 26 | + it('verse with 2 bottles', function() |
| 27 | + local expected = table.concat({ |
| 28 | + 'Two green bottles hanging on the wall,\n', |
| 29 | + 'Two green bottles hanging on the wall,\n', |
| 30 | + 'And if one green bottle should accidentally fall,\n', |
| 31 | + "There'll be one green bottle hanging on the wall.\n" |
| 32 | + }) |
| 33 | + assert.equal(expected, BottleSong.recite(2, 1)) |
| 34 | + end) |
34 | 35 |
|
35 | | - it('verse with 1 bottle', function() |
36 | | - expected = table.concat({ |
37 | | - "One green bottle hanging on the wall,\n", |
38 | | - "One green bottle hanging on the wall,\n", |
39 | | - "And if one green bottle should accidentally fall,\n", |
40 | | - "There'll be no green bottles hanging on the wall.\n" |
41 | | - }) |
42 | | - assert.equal(expected, BottleSong.recite(1, 1)) |
| 36 | + it('verse with 1 bottle', function() |
| 37 | + local expected = table.concat({ |
| 38 | + 'One green bottle hanging on the wall,\n', |
| 39 | + 'One green bottle hanging on the wall,\n', |
| 40 | + 'And if one green bottle should accidentally fall,\n', |
| 41 | + "There'll be no green bottles hanging on the wall.\n" |
| 42 | + }) |
| 43 | + assert.equal(expected, BottleSong.recite(1, 1)) |
| 44 | + end) |
43 | 45 | end) |
44 | 46 | end) |
45 | 47 |
|
46 | | - describe('multiple verses', function() |
47 | | - it('first two verses', function() |
48 | | - expected = table.concat({ |
49 | | - "Ten green bottles hanging on the wall,\n", |
50 | | - "Ten green bottles hanging on the wall,\n", |
51 | | - "And if one green bottle should accidentally fall,\n", |
52 | | - "There'll be nine green bottles hanging on the wall.\n", |
53 | | - "\n", |
54 | | - "Nine green bottles hanging on the wall,\n", |
55 | | - "Nine green bottles hanging on the wall,\n", |
56 | | - "And if one green bottle should accidentally fall,\n", |
57 | | - "There'll be eight green bottles hanging on the wall.\n" |
58 | | - }) |
59 | | - assert.equal(expected, BottleSong.recite(10, 2)) |
60 | | - end) |
| 48 | + describe('lyrics', function() |
| 49 | + describe('multiple verses', function() |
| 50 | + it('first two verses', function() |
| 51 | + local expected = table.concat({ |
| 52 | + 'Ten green bottles hanging on the wall,\n', |
| 53 | + 'Ten green bottles hanging on the wall,\n', |
| 54 | + 'And if one green bottle should accidentally fall,\n', |
| 55 | + "There'll be nine green bottles hanging on the wall.\n", |
| 56 | + '\n', |
| 57 | + 'Nine green bottles hanging on the wall,\n', |
| 58 | + 'Nine green bottles hanging on the wall,\n', |
| 59 | + 'And if one green bottle should accidentally fall,\n', |
| 60 | + "There'll be eight green bottles hanging on the wall.\n" |
| 61 | + }) |
| 62 | + assert.equal(expected, BottleSong.recite(10, 2)) |
| 63 | + end) |
61 | 64 |
|
62 | | - it('last three verses', function() |
63 | | - expected = table.concat({ |
64 | | - "Three green bottles hanging on the wall,\n", |
65 | | - "Three green bottles hanging on the wall,\n", |
66 | | - "And if one green bottle should accidentally fall,\n", |
67 | | - "There'll be two green bottles hanging on the wall.\n", |
68 | | - "\n", |
69 | | - "Two green bottles hanging on the wall,\n", |
70 | | - "Two green bottles hanging on the wall,\n", |
71 | | - "And if one green bottle should accidentally fall,\n", |
72 | | - "There'll be one green bottle hanging on the wall.\n", |
73 | | - "\n", |
74 | | - "One green bottle hanging on the wall,\n", |
75 | | - "One green bottle hanging on the wall,\n", |
76 | | - "And if one green bottle should accidentally fall,\n", |
77 | | - "There'll be no green bottles hanging on the wall.\n" |
78 | | - }) |
79 | | - assert.equal(expected, BottleSong.recite(3, 3)) |
80 | | - end) |
| 65 | + it('last three verses', function() |
| 66 | + local expected = table.concat({ |
| 67 | + 'Three green bottles hanging on the wall,\n', |
| 68 | + 'Three green bottles hanging on the wall,\n', |
| 69 | + 'And if one green bottle should accidentally fall,\n', |
| 70 | + "There'll be two green bottles hanging on the wall.\n", |
| 71 | + '\n', |
| 72 | + 'Two green bottles hanging on the wall,\n', |
| 73 | + 'Two green bottles hanging on the wall,\n', |
| 74 | + 'And if one green bottle should accidentally fall,\n', |
| 75 | + "There'll be one green bottle hanging on the wall.\n", |
| 76 | + '\n', |
| 77 | + 'One green bottle hanging on the wall,\n', |
| 78 | + 'One green bottle hanging on the wall,\n', |
| 79 | + 'And if one green bottle should accidentally fall,\n', |
| 80 | + "There'll be no green bottles hanging on the wall.\n" |
| 81 | + }) |
| 82 | + assert.equal(expected, BottleSong.recite(3, 3)) |
| 83 | + end) |
81 | 84 |
|
82 | | - it('all verses', function() |
83 | | - expected = table.concat({ |
84 | | - "Ten green bottles hanging on the wall,\n", |
85 | | - "Ten green bottles hanging on the wall,\n", |
86 | | - "And if one green bottle should accidentally fall,\n", |
87 | | - "There'll be nine green bottles hanging on the wall.\n", |
88 | | - "\n", |
89 | | - "Nine green bottles hanging on the wall,\n", |
90 | | - "Nine green bottles hanging on the wall,\n", |
91 | | - "And if one green bottle should accidentally fall,\n", |
92 | | - "There'll be eight green bottles hanging on the wall.\n", |
93 | | - "\n", |
94 | | - "Eight green bottles hanging on the wall,\n", |
95 | | - "Eight green bottles hanging on the wall,\n", |
96 | | - "And if one green bottle should accidentally fall,\n", |
97 | | - "There'll be seven green bottles hanging on the wall.\n", |
98 | | - "\n", |
99 | | - "Seven green bottles hanging on the wall,\n", |
100 | | - "Seven green bottles hanging on the wall,\n", |
101 | | - "And if one green bottle should accidentally fall,\n", |
102 | | - "There'll be six green bottles hanging on the wall.\n", |
103 | | - "\n", |
104 | | - "Six green bottles hanging on the wall,\n", |
105 | | - "Six green bottles hanging on the wall,\n", |
106 | | - "And if one green bottle should accidentally fall,\n", |
107 | | - "There'll be five green bottles hanging on the wall.\n", |
108 | | - "\n", |
109 | | - "Five green bottles hanging on the wall,\n", |
110 | | - "Five green bottles hanging on the wall,\n", |
111 | | - "And if one green bottle should accidentally fall,\n", |
112 | | - "There'll be four green bottles hanging on the wall.\n", |
113 | | - "\n", |
114 | | - "Four green bottles hanging on the wall,\n", |
115 | | - "Four green bottles hanging on the wall,\n", |
116 | | - "And if one green bottle should accidentally fall,\n", |
117 | | - "There'll be three green bottles hanging on the wall.\n", |
118 | | - "\n", |
119 | | - "Three green bottles hanging on the wall,\n", |
120 | | - "Three green bottles hanging on the wall,\n", |
121 | | - "And if one green bottle should accidentally fall,\n", |
122 | | - "There'll be two green bottles hanging on the wall.\n", |
123 | | - "\n", |
124 | | - "Two green bottles hanging on the wall,\n", |
125 | | - "Two green bottles hanging on the wall,\n", |
126 | | - "And if one green bottle should accidentally fall,\n", |
127 | | - "There'll be one green bottle hanging on the wall.\n", |
128 | | - "\n", |
129 | | - "One green bottle hanging on the wall,\n", |
130 | | - "One green bottle hanging on the wall,\n", |
131 | | - "And if one green bottle should accidentally fall,\n", |
132 | | - "There'll be no green bottles hanging on the wall.\n" |
133 | | - }) |
134 | | - assert.equal(expected, BottleSong.recite(10, 10)) |
| 85 | + it('all verses', function() |
| 86 | + local expected = table.concat({ |
| 87 | + 'Ten green bottles hanging on the wall,\n', |
| 88 | + 'Ten green bottles hanging on the wall,\n', |
| 89 | + 'And if one green bottle should accidentally fall,\n', |
| 90 | + "There'll be nine green bottles hanging on the wall.\n", |
| 91 | + '\n', |
| 92 | + 'Nine green bottles hanging on the wall,\n', |
| 93 | + 'Nine green bottles hanging on the wall,\n', |
| 94 | + 'And if one green bottle should accidentally fall,\n', |
| 95 | + "There'll be eight green bottles hanging on the wall.\n", |
| 96 | + '\n', |
| 97 | + 'Eight green bottles hanging on the wall,\n', |
| 98 | + 'Eight green bottles hanging on the wall,\n', |
| 99 | + 'And if one green bottle should accidentally fall,\n', |
| 100 | + "There'll be seven green bottles hanging on the wall.\n", |
| 101 | + '\n', |
| 102 | + 'Seven green bottles hanging on the wall,\n', |
| 103 | + 'Seven green bottles hanging on the wall,\n', |
| 104 | + 'And if one green bottle should accidentally fall,\n', |
| 105 | + "There'll be six green bottles hanging on the wall.\n", |
| 106 | + '\n', |
| 107 | + 'Six green bottles hanging on the wall,\n', |
| 108 | + 'Six green bottles hanging on the wall,\n', |
| 109 | + 'And if one green bottle should accidentally fall,\n', |
| 110 | + "There'll be five green bottles hanging on the wall.\n", |
| 111 | + '\n', |
| 112 | + 'Five green bottles hanging on the wall,\n', |
| 113 | + 'Five green bottles hanging on the wall,\n', |
| 114 | + 'And if one green bottle should accidentally fall,\n', |
| 115 | + "There'll be four green bottles hanging on the wall.\n", |
| 116 | + '\n', |
| 117 | + 'Four green bottles hanging on the wall,\n', |
| 118 | + 'Four green bottles hanging on the wall,\n', |
| 119 | + 'And if one green bottle should accidentally fall,\n', |
| 120 | + "There'll be three green bottles hanging on the wall.\n", |
| 121 | + '\n', |
| 122 | + 'Three green bottles hanging on the wall,\n', |
| 123 | + 'Three green bottles hanging on the wall,\n', |
| 124 | + 'And if one green bottle should accidentally fall,\n', |
| 125 | + "There'll be two green bottles hanging on the wall.\n", |
| 126 | + '\n', |
| 127 | + 'Two green bottles hanging on the wall,\n', |
| 128 | + 'Two green bottles hanging on the wall,\n', |
| 129 | + 'And if one green bottle should accidentally fall,\n', |
| 130 | + "There'll be one green bottle hanging on the wall.\n", |
| 131 | + '\n', |
| 132 | + 'One green bottle hanging on the wall,\n', |
| 133 | + 'One green bottle hanging on the wall,\n', |
| 134 | + 'And if one green bottle should accidentally fall,\n', |
| 135 | + "There'll be no green bottles hanging on the wall.\n" |
| 136 | + }) |
| 137 | + assert.equal(expected, BottleSong.recite(10, 10)) |
| 138 | + end) |
135 | 139 | end) |
136 | 140 | end) |
137 | 141 | end) |
0 commit comments