trackler 2.0.8.18 → 2.0.8.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/common/.gitignore +1 -0
  3. data/common/.travis.yml +5 -8
  4. data/common/README.md +18 -5
  5. data/common/exercises/grep/canonical-data.json +290 -269
  6. data/common/exercises/phone-number/canonical-data.json +2 -2
  7. data/common/exercises/pov/canonical-data.json +2 -5
  8. data/common/exercises/roman-numerals/canonical-data.json +112 -74
  9. data/common/exercises/tournament/canonical-data.json +86 -85
  10. data/common/exercises/two-bucket/canonical-data.json +55 -47
  11. data/common/package.json +16 -0
  12. data/common/yarn.lock +195 -0
  13. data/lib/trackler/version.rb +1 -1
  14. data/tracks/c/docs/LEARNING.md +1 -1
  15. data/tracks/c/exercises/space-age/src/example.c +15 -47
  16. data/tracks/c/exercises/space-age/src/example.h +12 -8
  17. data/tracks/c/exercises/space-age/test/test_space_age.c +8 -8
  18. data/tracks/ceylon/docs/TESTS.md +5 -2
  19. data/tracks/ceylon/exercises/TRACK_HINTS.md +5 -2
  20. data/tracks/csharp/.gitignore +0 -4
  21. data/tracks/csharp/.travis.yml +9 -20
  22. data/tracks/csharp/appveyor.yml +2 -4
  23. data/tracks/csharp/build.cake +95 -0
  24. data/tracks/csharp/build.ps1 +189 -0
  25. data/tracks/csharp/build.sh +99 -31
  26. data/tracks/csharp/circle.yml +3 -12
  27. data/tracks/delphi/config.json +8 -0
  28. data/tracks/delphi/exercises/minesweeper/MineSweeper.dpr +60 -0
  29. data/tracks/delphi/exercises/minesweeper/uMineSweeperExample.pas +70 -0
  30. data/tracks/delphi/exercises/minesweeper/uMineSweeperTest.pas +270 -0
  31. data/tracks/dlang/config.json +86 -31
  32. data/tracks/elixir/config.json +7 -0
  33. data/tracks/elixir/exercises/rotational-cipher/example.exs +35 -0
  34. data/tracks/elixir/exercises/rotational-cipher/rotational_cipher.exs +13 -0
  35. data/tracks/elixir/exercises/rotational-cipher/rotational_cipher_test.exs +80 -0
  36. data/tracks/go/exercises/raindrops/raindrops_test.go +4 -1
  37. data/tracks/go/exercises/react/react_test.go +6 -8
  38. data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +4 -1
  39. data/tracks/go/exercises/robot-simulator/robot_simulator_test.go +5 -2
  40. data/tracks/haskell/exercises/allergies/src/Allergies.hs +2 -2
  41. data/tracks/haskell/exercises/atbash-cipher/src/Atbash.hs +2 -2
  42. data/tracks/haskell/exercises/bank-account/src/BankAccount.hs +3 -3
  43. data/tracks/haskell/exercises/binary-search-tree/src/BST.hs +7 -7
  44. data/tracks/haskell/exercises/bowling/src/Bowling.hs +1 -1
  45. data/tracks/haskell/exercises/clock/src/Clock.hs +4 -4
  46. data/tracks/haskell/exercises/connect/src/Connect.hs +1 -1
  47. data/tracks/haskell/exercises/crypto-square/src/CryptoSquare.hs +1 -1
  48. data/tracks/haskell/exercises/custom-set/src/CustomSet.hs +12 -12
  49. data/tracks/haskell/exercises/difference-of-squares/src/Squares.hs +3 -3
  50. data/tracks/haskell/exercises/etl/src/ETL.hs +1 -1
  51. data/tracks/haskell/exercises/forth/src/Forth.hs +2 -2
  52. data/tracks/haskell/exercises/go-counting/src/Counting.hs +2 -2
  53. data/tracks/haskell/exercises/kindergarten-garden/src/Garden.hs +3 -3
  54. data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -1
  55. data/tracks/haskell/exercises/lens-person/src/Person.hs +4 -4
  56. data/tracks/julia/.travis.yml +3 -2
  57. data/tracks/ocaml/exercises/all-your-base/test.ml +2 -2
  58. data/tracks/ocaml/exercises/beer-song/test.ml +25 -24
  59. data/tracks/ocaml/exercises/phone-number/test.ml +22 -22
  60. data/tracks/ocaml/exercises/run-length-encoding/test.ml +5 -5
  61. data/tracks/ocaml/exercises/word-count/test.ml +1 -1
  62. data/tracks/ocaml/tools/test-generator/templates/beer-song/template.ml +20 -1
  63. data/tracks/purescript/config.json +7 -0
  64. data/tracks/purescript/exercises/word-count/bower.json +17 -0
  65. data/tracks/purescript/exercises/word-count/examples/src/WordCount.purs +31 -0
  66. data/tracks/purescript/exercises/word-count/src/WordCount.purs +3 -0
  67. data/tracks/purescript/exercises/word-count/test/Main.purs +89 -0
  68. data/tracks/python/exercises/accumulate/accumulate.py +2 -0
  69. data/tracks/python/exercises/acronym/acronym.py +2 -0
  70. data/tracks/python/exercises/allergies/allergies.py +3 -0
  71. data/tracks/python/exercises/allergies/example.py +1 -1
  72. data/tracks/python/exercises/anagram/anagram.py +2 -0
  73. data/tracks/python/exercises/atbash-cipher/atbash_cipher.py +6 -0
  74. data/tracks/python/exercises/beer-song/beer_song.py +6 -0
  75. data/tracks/python/exercises/binary-search/binary_search.py +2 -0
  76. data/tracks/python/exercises/binary/binary.py +2 -0
  77. data/tracks/python/exercises/bob/bob.py +2 -8
  78. data/tracks/python/exercises/bracket-push/bracket_push.py +2 -0
  79. data/tracks/python/exercises/circular-buffer/circular_buffer.py +11 -0
  80. data/tracks/python/exercises/clock/clock.py +3 -0
  81. data/tracks/python/exercises/clock/example.py +1 -1
  82. data/tracks/python/exercises/crypto-square/crypto_square.py +2 -0
  83. data/tracks/python/exercises/diamond/diamond.py +2 -0
  84. data/tracks/python/exercises/difference-of-squares/difference_of_squares.py +10 -0
  85. data/tracks/python/exercises/etl/etl.py +2 -0
  86. data/tracks/python/exercises/flatten-array/flatten_array.py +2 -0
  87. data/tracks/python/exercises/gigasecond/gigasecond.py +2 -0
  88. data/tracks/python/exercises/grade-school/grade_school.py +3 -0
  89. data/tracks/python/exercises/grains/grains.py +6 -0
  90. data/tracks/python/exercises/hamming/hamming.py +2 -0
  91. data/tracks/python/exercises/hello-world/hello_world.py +2 -7
  92. data/tracks/python/exercises/hexadecimal/hexadecimal.py +2 -0
  93. data/tracks/python/exercises/house/house.py +6 -0
  94. data/tracks/python/exercises/kindergarten-garden/kindergarten_garden.py +3 -0
  95. data/tracks/python/exercises/largest-series-product/largest_series_product.py +2 -0
  96. data/tracks/python/exercises/leap/leap.py +2 -0
  97. data/tracks/python/exercises/linked-list/linked_list.py +2 -8
  98. data/tracks/python/exercises/list-ops/list_ops.py +18 -22
  99. data/tracks/python/exercises/luhn/luhn.py +3 -0
  100. data/tracks/python/exercises/matrix/matrix.py +3 -0
  101. data/tracks/python/exercises/meetup/meetup.py +2 -0
  102. data/tracks/python/exercises/minesweeper/minesweeper.py +2 -0
  103. data/tracks/python/exercises/nth-prime/nth_prime.py +2 -0
  104. data/tracks/python/exercises/nucleotide-count/nucleotide_count.py +6 -0
  105. data/tracks/python/exercises/ocr-numbers/ocr_numbers.py +6 -0
  106. data/tracks/python/exercises/ocr-numbers/{ocr_test.py → ocr_numbers_test.py} +0 -0
  107. data/tracks/python/exercises/octal/octal.py +2 -0
  108. data/tracks/python/exercises/palindrome-products/palindrome_products.py +6 -0
  109. data/tracks/python/exercises/pangram/pangram.py +2 -0
  110. data/tracks/python/exercises/pascals-triangle/pascals_triangle.py +10 -0
  111. data/tracks/python/exercises/perfect-numbers/perfect_numbers.py +6 -0
  112. data/tracks/python/exercises/phone-number/phone_number.py +3 -0
  113. data/tracks/python/exercises/pig-latin/pig_latin.py +2 -0
  114. data/tracks/python/exercises/point-mutations/point_mutations.py +2 -0
  115. data/tracks/python/exercises/poker/poker.py +2 -0
  116. data/tracks/python/exercises/prime-factors/prime_factors.py +2 -0
  117. data/tracks/python/exercises/proverb/proverb.py +2 -0
  118. data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet.py +10 -0
  119. data/tracks/python/exercises/queen-attack/queen_attack.py +6 -0
  120. data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher.py +10 -0
  121. data/tracks/python/exercises/raindrops/raindrops.py +2 -0
  122. data/tracks/python/exercises/rectangles/example.py +1 -1
  123. data/tracks/python/exercises/rectangles/rectangles.py +2 -0
  124. data/tracks/python/exercises/rectangles/{rectangles_count_test.py → rectangles_test.py} +0 -0
  125. data/tracks/python/exercises/rna-transcription/rna_transcription.py +2 -0
  126. data/tracks/python/exercises/robot-name/robot_name.py +3 -0
  127. data/tracks/python/exercises/robot-simulator/robot_simulator.py +3 -0
  128. data/tracks/python/exercises/roman-numerals/roman_numerals.py +2 -0
  129. data/tracks/python/exercises/run-length-encoding/run_length_encoding.py +6 -0
  130. data/tracks/python/exercises/run-length-encoding/{run_length_test.py → run_length_encoding_test.py} +1 -1
  131. data/tracks/python/exercises/saddle-points/saddle_points.py +2 -0
  132. data/tracks/python/exercises/say/example.py +1 -1
  133. data/tracks/python/exercises/say/say.py +2 -0
  134. data/tracks/python/exercises/say/say_test.py +3 -0
  135. data/tracks/python/exercises/scrabble-score/scrabble_score.py +2 -0
  136. data/tracks/python/exercises/secret-handshake/secret_handshake.py +6 -0
  137. data/tracks/python/exercises/secret-handshake/{handshake_test.py → secret_handshake_test.py} +0 -0
  138. data/tracks/python/exercises/series/series.py +2 -0
  139. data/tracks/python/exercises/sieve/sieve.py +2 -0
  140. data/tracks/python/exercises/simple-cipher/example.py +1 -1
  141. data/tracks/python/exercises/simple-cipher/simple_cipher.py +8 -0
  142. data/tracks/python/exercises/space-age/space_age.py +3 -0
  143. data/tracks/python/exercises/strain/strain.py +6 -0
  144. data/tracks/python/exercises/sublist/sublist.py +2 -0
  145. data/tracks/python/exercises/sum-of-multiples/sum_of_multiples.py +2 -0
  146. data/tracks/python/exercises/triangle/triangle.py +7 -0
  147. data/tracks/python/exercises/trinary/trinary.py +2 -0
  148. data/tracks/python/exercises/twelve-days/twelve_days.py +10 -0
  149. data/tracks/python/exercises/word-count/word_count.py +2 -0
  150. data/tracks/python/exercises/wordy/wordy.py +2 -0
  151. data/tracks/python/exercises/zebra-puzzle/zebra_puzzle.py +2 -0
  152. data/tracks/ruby/exercises/beer-song/.meta/.version +1 -0
  153. data/tracks/ruby/exercises/beer-song/beer_song_test.rb +62 -36
  154. data/tracks/ruby/exercises/beer-song/example.rb +1 -5
  155. data/tracks/ruby/exercises/beer-song/example.tt +22 -0
  156. data/tracks/ruby/lib/beer_song_cases.rb +43 -0
  157. data/tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift +1 -1
  158. metadata +94 -13
  159. data/common/bin/jsonlint +0 -27
  160. data/tracks/csharp/.paket/paket.bootstrapper.exe +0 -0
  161. data/tracks/csharp/Zipper.cs +0 -137
  162. data/tracks/csharp/build.cmd +0 -14
  163. data/tracks/csharp/build.fsx +0 -78
  164. data/tracks/csharp/paket.dependencies +0 -2
  165. data/tracks/csharp/paket.lock +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8dc58526fa26ab3ee7b880060f19b9ff38f74b50
4
- data.tar.gz: 500d43b55f63f5549d3c0f88de2e5e8eef4a4bc3
3
+ metadata.gz: 1a18e7d1d01de5dac14394d4c662332c16d96702
4
+ data.tar.gz: ea97a61252024003df91aed43f471bed17ebd3eb
5
5
  SHA512:
6
- metadata.gz: d94503aabd35ef75be0b356984f834a0e8ee6b537dbe2f2e4002e5f9fa6ea0ea78224ab5edfa1ea30a58e563ad458480b3732172aa9955b99ca81c9c2f2367ed
7
- data.tar.gz: 19bac46a8dfb31ec316cd4db44641fb476224a018537e7f0de83b83ee423c5826c623fa6d44be744a2dd87a264b6b84f94f21ed8edcda8c019be3e7e6b51fd2d
6
+ metadata.gz: fd8893f9ee7a77e3cd946e475be1dd3d598a3749fd167037ac5279ccdeb01e88d3caf2bdedcee4cbceb161be47705ac79d4443be9238e2faf5e39599a16213d8
7
+ data.tar.gz: 13dd5a5e0552cb679fce68a2adbccb3fb588aa31ab627420cc81d4855f82fe56ed13138caa90c8965a08e6cca4f62577390117ed40cc58ca69024c0e0d063dda
data/common/.gitignore ADDED
@@ -0,0 +1 @@
1
+ node_modules
data/common/.travis.yml CHANGED
@@ -1,12 +1,9 @@
1
- language: bash
1
+ language: node_js
2
+ node_js:
3
+ - "6"
2
4
 
3
- sudo: false
4
-
5
- addons:
6
- apt:
7
- packages:
8
- - jq
5
+ cache: yarn
9
6
 
10
7
  script:
11
- - bin/jsonlint
12
8
  - bin/check_required_files_present
9
+ - npm test
data/common/README.md CHANGED
@@ -113,13 +113,26 @@ There are also some convention about `expected` that you must follow:
113
113
 
114
114
  ## Automated Tests
115
115
 
116
- The only thing that we're testing at the moment, is whether or not `canonical-data.json`
117
- is valid json.
116
+ `canonical-data.json` for each exercise is checked for compliancy against the [canonical-schema.json](canonical-schema.json).
117
+ In order to run these tests, you will need to have `node` and `npm` installed on your system.
118
+ Install them from [here](https://nodejs.org/en/). (`npm` comes bundled with most installations of `node`).
118
119
 
119
- If you want to run this before you commit, you will need to install
120
- [jq](https://stedolan.github.io/jq/download/). Then run the script with:
120
+ Install the required packages:
121
+ ```shell
122
+ npm install
123
+ ```
124
+
125
+ Run for all exercises:
126
+ ```shell
127
+ npm test
128
+ ```
129
+
130
+ Run for single exercise:
131
+ ```shell
132
+ npm test-one exercises/<exercise>/canonical-data.json
133
+ ```
134
+ Replace `<exercise>` by the name of exercise which you want to check.
121
135
 
122
- bin/jsonlint
123
136
 
124
137
  ## License
125
138
 
@@ -1,276 +1,297 @@
1
- {
2
- "#": [
3
- "JSON doesn't allow for multi-line strings, so all outputs are presented ",
4
- "here as arrays of strings. It's up to the test generator to join the ",
5
- "lines together with line breaks.",
6
- "",
7
- "The tests are divided into two groups: ",
8
- "* Grepping a single file",
9
- "* Grepping multiple files at once",
10
- "",
11
- "The language track implementing this exercise should",
12
- "ensure that when the tests run, three files are created",
13
- "with the following contents. The file names and their",
14
- "contents are listed in the 'files' section below."
15
- ],
16
- "files": [
1
+ {
2
+ "exercise": "grep",
3
+ "version": "1.0.0",
4
+ "comments": [
5
+ " JSON doesn't allow for multi-line strings, so all ",
6
+ " outputs are presented here as arrays of strings. ",
7
+ " It's up to the test generator to join the lines ",
8
+ " together with line breaks. ",
9
+ " ",
10
+ " The tests are divided into two groups: ",
11
+ " - Grepping a single file ",
12
+ " - Grepping multiple files at once ",
13
+ " ",
14
+ " The language track implementing this exercise ",
15
+ " should ensure that when the tests run, three files ",
16
+ " are created with the following contents. The file ",
17
+ " names and their contents are listed below: ",
18
+ " ",
19
+ " iliad.txt ",
20
+ " --------------------------------------------- ",
21
+ " |Achilles sing, O Goddess! Peleus' son; | ",
22
+ " |His wrath pernicious, who ten thousand woes| ",
23
+ " |Caused to Achaia's host, sent many a soul | ",
24
+ " |Illustrious into Ades premature, | ",
25
+ " |And Heroes gave (so stood the will of Jove)| ",
26
+ " |To dogs and to all ravening fowls a prey, | ",
27
+ " |When fierce dispute had separated once | ",
28
+ " |The noble Chief Achilles from the son | ",
29
+ " |Of Atreus, Agamemnon, King of men. | ",
30
+ " --------------------------------------------- ",
31
+ " ",
32
+ " midsummer-night.txt ",
33
+ " ----------------------------------------------- ",
34
+ " |I do entreat your grace to pardon me. | ",
35
+ " |I know not by what power I am made bold, | ",
36
+ " |Nor how it may concern my modesty, | ",
37
+ " |In such a presence here to plead my thoughts;| ",
38
+ " |But I beseech your grace that I may know | ",
39
+ " |The worst that may befall me in this case, | ",
40
+ " |If I refuse to wed Demetrius. | ",
41
+ " ----------------------------------------------- ",
42
+ " ",
43
+ " paradise-lost.txt ",
44
+ " ------------------------------------------------- ",
45
+ " |Of Mans First Disobedience, and the Fruit | ",
46
+ " |Of that Forbidden Tree, whose mortal tast | ",
47
+ " |Brought Death into the World, and all our woe, | ",
48
+ " |With loss of Eden, till one greater Man | ",
49
+ " |Restore us, and regain the blissful Seat, | ",
50
+ " |Sing Heav'nly Muse, that on the secret top | ",
51
+ " |Of Oreb, or of Sinai, didst inspire | ",
52
+ " |That Shepherd, who first taught the chosen Seed| ",
53
+ " ------------------------------------------------- "
54
+ ],
55
+ "cases": [
56
+ {
57
+ "description": "Test grepping a single file",
58
+ "cases": [
17
59
  {
18
- "name": "iliad.txt",
19
- "contents": [
20
- "Achilles sing, O Goddess! Peleus' son;",
21
- "His wrath pernicious, who ten thousand woes",
22
- "Caused to Achaia's host, sent many a soul",
23
- "Illustrious into Ades premature,",
24
- "And Heroes gave (so stood the will of Jove)",
25
- "To dogs and to all ravening fowls a prey,",
26
- "When fierce dispute had separated once",
27
- "The noble Chief Achilles from the son",
28
- "Of Atreus, Agamemnon, King of men."
29
- ]
30
- },
60
+ "description": "One file, one match, no flags",
61
+ "property": "grep",
62
+ "pattern": "Agamemnon",
63
+ "flags": [],
64
+ "files": ["iliad.txt"],
65
+ "expected": [
66
+ "Of Atreus, Agamemnon, King of men."
67
+ ]
68
+ },
69
+ {
70
+ "description": "One file, one match, print line numbers flag",
71
+ "property": "grep",
72
+ "pattern": "Forbidden",
73
+ "flags": ["-n"],
74
+ "files": ["paradise-lost.txt"],
75
+ "expected": [
76
+ "2:Of that Forbidden Tree, whose mortal tast"
77
+ ]
78
+ },
79
+ {
80
+ "description": "One file, one match, case-insensitive flag",
81
+ "property": "grep",
82
+ "pattern": "FORBIDDEN",
83
+ "flags": ["-i"],
84
+ "files": ["paradise-lost.txt"],
85
+ "expected": [
86
+ "Of that Forbidden Tree, whose mortal tast"
87
+ ]
88
+ },
89
+ {
90
+ "description": "One file, one match, print file names flag",
91
+ "property": "grep",
92
+ "pattern": "Forbidden",
93
+ "flags": ["-l"],
94
+ "files": ["paradise-lost.txt"],
95
+ "expected": [
96
+ "paradise-lost.txt"
97
+ ]
98
+ },
99
+ {
100
+ "description": "One file, one match, match entire lines flag",
101
+ "property": "grep",
102
+ "pattern": "With loss of Eden, till one greater Man",
103
+ "flags": ["-x"],
104
+ "files": ["paradise-lost.txt"],
105
+ "expected": [
106
+ "With loss of Eden, till one greater Man"
107
+ ]
108
+ },
109
+ {
110
+ "description": "One file, one match, multiple flags",
111
+ "property": "grep",
112
+ "pattern": "OF ATREUS, Agamemnon, KIng of MEN.",
113
+ "flags": ["-n", "-i", "-x"],
114
+ "files": ["iliad.txt"],
115
+ "expected": [
116
+ "9:Of Atreus, Agamemnon, King of men."
117
+ ]
118
+ },
119
+ {
120
+ "description": "One file, several matches, no flags",
121
+ "property": "grep",
122
+ "pattern": "may",
123
+ "flags": [],
124
+ "files": ["midsummer-night.txt"],
125
+ "expected": [
126
+ "Nor how it may concern my modesty,",
127
+ "But I beseech your grace that I may know",
128
+ "The worst that may befall me in this case,"
129
+ ]
130
+ },
131
+ {
132
+ "description": "One file, several matches, print line numbers flag",
133
+ "property": "grep",
134
+ "pattern": "may",
135
+ "flags": ["-n"],
136
+ "files": ["midsummer-night.txt"],
137
+ "expected": [
138
+ "3:Nor how it may concern my modesty,",
139
+ "5:But I beseech your grace that I may know",
140
+ "6:The worst that may befall me in this case,"
141
+ ]
142
+ },
143
+ {
144
+ "description": "One file, several matches, match entire lines flag",
145
+ "property": "grep",
146
+ "pattern": "may",
147
+ "flags": ["-x"],
148
+ "files": ["midsummer-night.txt"],
149
+ "expected": []
150
+ },
151
+ {
152
+ "description": "One file, several matches, case-insensitive flag",
153
+ "property": "grep",
154
+ "pattern": "ACHILLES",
155
+ "flags": ["-i"],
156
+ "files": ["iliad.txt"],
157
+ "expected": [
158
+ "Achilles sing, O Goddess! Peleus' son;",
159
+ "The noble Chief Achilles from the son"
160
+ ]
161
+ },
31
162
  {
32
- "name": "midsummer-night.txt",
33
- "contents": [
34
- "I do entreat your grace to pardon me.",
35
- "I know not by what power I am made bold,",
36
- "Nor how it may concern my modesty,",
37
- "In such a presence here to plead my thoughts;",
38
- "But I beseech your grace that I may know",
39
- "The worst that may befall me in this case,",
40
- "If I refuse to wed Demetrius."
41
- ]
163
+ "description": "One file, several matches, inverted flag",
164
+ "property": "grep",
165
+ "pattern": "Of",
166
+ "flags": ["-v"],
167
+ "files": ["paradise-lost.txt"],
168
+ "expected": [
169
+ "Brought Death into the World, and all our woe,",
170
+ "With loss of Eden, till one greater Man",
171
+ "Restore us, and regain the blissful Seat,",
172
+ "Sing Heav'nly Muse, that on the secret top",
173
+ "That Shepherd, who first taught the chosen Seed"
174
+ ]
42
175
  },
43
176
  {
44
- "name": "paradise-lost.txt",
45
- "contents": [
46
- "Of Mans First Disobedience, and the Fruit",
47
- "Of that Forbidden Tree, whose mortal tast",
48
- "Brought Death into the World, and all our woe,",
49
- "With loss of Eden, till one greater Man",
50
- "Restore us, and regain the blissful Seat,",
51
- "Sing Heav'nly Muse, that on the secret top",
52
- "Of Oreb, or of Sinai, didst inspire",
53
- "That Shepherd, who first taught the chosen Seed"
54
- ]
177
+ "description": "One file, no matches, various flags",
178
+ "property": "grep",
179
+ "pattern": "Gandalf",
180
+ "flags": ["-n", "-l", "-x", "-i"],
181
+ "files": ["iliad.txt"],
182
+ "expected": []
55
183
  }
56
- ],
57
- "single-file": {
58
- "description": ["Test grepping a single file"],
59
- "cases": [
60
- {
61
- "description": "One file, one match, no flags",
62
- "pattern": "Agamemnon",
63
- "flags": [],
64
- "files": ["iliad.txt"],
65
- "expected": [
66
- "Of Atreus, Agamemnon, King of men."
67
- ]
68
- },
69
- {
70
- "description": "One file, one match, print line numbers flag",
71
- "pattern": "Forbidden",
72
- "flags": ["-n"],
73
- "files": ["paradise-lost.txt"],
74
- "expected": [
75
- "2:Of that Forbidden Tree, whose mortal tast"
76
- ]
77
- },
78
- {
79
- "description": "One file, one match, case-insensitive flag",
80
- "pattern": "FORBIDDEN",
81
- "flags": ["-i"],
82
- "files": ["paradise-lost.txt"],
83
- "expected": [
84
- "Of that Forbidden Tree, whose mortal tast"
85
- ]
86
- },
87
- {
88
- "description": "One file, one match, print file names flag",
89
- "pattern": "Forbidden",
90
- "flags": ["-l"],
91
- "files": ["paradise-lost.txt"],
92
- "expected": [
93
- "paradise-lost.txt"
94
- ]
95
- },
96
- {
97
- "description": "One file, one match, match entire lines flag",
98
- "pattern": "With loss of Eden, till one greater Man",
99
- "flags": ["-x"],
100
- "files": ["paradise-lost.txt"],
101
- "expected": [
102
- "With loss of Eden, till one greater Man"
103
- ]
104
- },
105
- {
106
- "description": "One file, one match, multiple flags",
107
- "pattern": "OF ATREUS, Agamemnon, KIng of MEN.",
108
- "flags": ["-n", "-i", "-x"],
109
- "files": ["iliad.txt"],
110
- "expected": [
111
- "9:Of Atreus, Agamemnon, King of men."
112
- ]
113
- },
114
- {
115
- "description": "One file, several matches, no flags",
116
- "pattern": "may",
117
- "flags": [],
118
- "files": ["midsummer-night.txt"],
119
- "expected": [
120
- "Nor how it may concern my modesty,",
121
- "But I beseech your grace that I may know",
122
- "The worst that may befall me in this case,"
123
- ]
124
- },
125
- {
126
- "description": "One file, several matches, print line numbers flag",
127
- "pattern": "may",
128
- "flags": ["-n"],
129
- "files": ["midsummer-night.txt"],
130
- "expected": [
131
- "3:Nor how it may concern my modesty,",
132
- "5:But I beseech your grace that I may know",
133
- "6:The worst that may befall me in this case,"
134
- ]
135
- },
136
- {
137
- "description": "One file, several matches, match entire lines flag",
138
- "pattern": "may",
139
- "flags": ["-x"],
140
- "files": ["midsummer-night.txt"],
141
- "expected": []
142
- },
143
- {
144
- "description": "One file, several matches, case-insensitive flag",
145
- "pattern": "ACHILLES",
146
- "flags": ["-i"],
147
- "files": ["iliad.txt"],
148
- "expected": [
149
- "Achilles sing, O Goddess! Peleus' son;",
150
- "The noble Chief Achilles from the son"
151
- ]
152
- },
153
- {
154
- "description": "One file, several matches, inverted flag",
155
- "pattern": "Of",
156
- "flags": ["-v"],
157
- "files": ["paradise-lost.txt"],
158
- "expected": [
159
- "Brought Death into the World, and all our woe,",
160
- "With loss of Eden, till one greater Man",
161
- "Restore us, and regain the blissful Seat,",
162
- "Sing Heav'nly Muse, that on the secret top",
163
- "That Shepherd, who first taught the chosen Seed"
164
- ]
165
- },
166
- {
167
- "description": "One file, no matches, various flags",
168
- "pattern": "Gandalf",
169
- "flags": ["-n", "-l", "-x", "-i"],
170
- "files": ["iliad.txt"],
171
- "expected": []
172
- }
173
- ]
184
+ ]
174
185
  },
175
- "multiple-files": {
176
- "description": ["Test grepping multiples files at once"],
177
- "cases": [
178
- {
179
- "description": "Multiple files, one match, no flags",
180
- "pattern": "Agamemnon",
181
- "flags": [],
182
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
183
- "expected": [
184
- "iliad.txt:Of Atreus, Agamemnon, King of men."
185
- ]
186
- },
187
- {
188
- "description": "Multiple files, several matches, no flags",
189
- "pattern": "may",
190
- "flags": [],
191
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
192
- "expected": [
193
- "midsummer-night.txt:Nor how it may concern my modesty,",
194
- "midsummer-night.txt:But I beseech your grace that I may know",
195
- "midsummer-night.txt:The worst that may befall me in this case,"
196
- ]
197
- },
198
- {
199
- "description": "Multiple files, several matches, print line numbers flag",
200
- "pattern": "that",
201
- "flags": ["-n"],
202
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
203
- "expected": [
204
- "midsummer-night.txt:5:But I beseech your grace that I may know",
205
- "midsummer-night.txt:6:The worst that may befall me in this case,",
206
- "paradise-lost.txt:2:Of that Forbidden Tree, whose mortal tast",
207
- "paradise-lost.txt:6:Sing Heav'nly Muse, that on the secret top"
208
- ]
209
- },
210
- {
211
- "description": "Multiple files, one match, print file names flag",
212
- "pattern": "who",
213
- "flags": ["-l"],
214
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
215
- "expected": [
216
- "iliad.txt",
217
- "paradise-lost.txt"
218
- ]
219
- },
220
- {
221
- "description": "Multiple files, several matches, case-insensitive flag",
222
- "pattern": "TO",
223
- "flags": ["-i"],
224
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
225
- "expected": [
226
- "iliad.txt:Caused to Achaia's host, sent many a soul",
227
- "iliad.txt:Illustrious into Ades premature,",
228
- "iliad.txt:And Heroes gave (so stood the will of Jove)",
229
- "iliad.txt:To dogs and to all ravening fowls a prey,",
230
- "midsummer-night.txt:I do entreat your grace to pardon me.",
231
- "midsummer-night.txt:In such a presence here to plead my thoughts;",
232
- "midsummer-night.txt:If I refuse to wed Demetrius.",
233
- "paradise-lost.txt:Brought Death into the World, and all our woe,",
234
- "paradise-lost.txt:Restore us, and regain the blissful Seat,",
235
- "paradise-lost.txt:Sing Heav'nly Muse, that on the secret top"
236
- ]
237
- },
238
- {
239
- "description": "Multiple files, several matches, inverted flag",
240
- "pattern": "a",
241
- "flags": ["-v"],
242
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
243
- "expected": [
244
- "iliad.txt:Achilles sing, O Goddess! Peleus' son;",
245
- "iliad.txt:The noble Chief Achilles from the son",
246
- "midsummer-night.txt:If I refuse to wed Demetrius."
247
- ]
248
- },
249
- {
250
- "description": "Multiple files, one match, match entire lines flag",
251
- "pattern": "But I beseech your grace that I may know",
252
- "flags": ["-x"],
253
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
254
- "expected": [
255
- "midsummer-night.txt:But I beseech your grace that I may know"
256
- ]
257
- },
258
- {
259
- "description": "Multiple files, one match, multiple flags",
260
- "pattern": "WITH LOSS OF EDEN, TILL ONE GREATER MAN",
261
- "flags": ["-n", "-i", "-x"],
262
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
263
- "expected": [
264
- "paradise-lost.txt:4:With loss of Eden, till one greater Man"
265
- ]
266
- },
267
- {
268
- "description": "Multiple files, no matches, various flags",
269
- "pattern": "Frodo",
270
- "flags": ["-n", "-l", "-x", "-i"],
271
- "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
272
- "expected": []
273
- }
274
- ]
186
+ {
187
+ "description": "Test grepping multiples files at once",
188
+ "cases": [
189
+ {
190
+ "description": "Multiple files, one match, no flags",
191
+ "property": "grep",
192
+ "pattern": "Agamemnon",
193
+ "flags": [],
194
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
195
+ "expected": [
196
+ "iliad.txt:Of Atreus, Agamemnon, King of men."
197
+ ]
198
+ },
199
+ {
200
+ "description": "Multiple files, several matches, no flags",
201
+ "property": "grep",
202
+ "pattern": "may",
203
+ "flags": [],
204
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
205
+ "expected": [
206
+ "midsummer-night.txt:Nor how it may concern my modesty,",
207
+ "midsummer-night.txt:But I beseech your grace that I may know",
208
+ "midsummer-night.txt:The worst that may befall me in this case,"
209
+ ]
210
+ },
211
+ {
212
+ "description": "Multiple files, several matches, print line numbers flag",
213
+ "property": "grep",
214
+ "pattern": "that",
215
+ "flags": ["-n"],
216
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
217
+ "expected": [
218
+ "midsummer-night.txt:5:But I beseech your grace that I may know",
219
+ "midsummer-night.txt:6:The worst that may befall me in this case,",
220
+ "paradise-lost.txt:2:Of that Forbidden Tree, whose mortal tast",
221
+ "paradise-lost.txt:6:Sing Heav'nly Muse, that on the secret top"
222
+ ]
223
+ },
224
+ {
225
+ "description": "Multiple files, one match, print file names flag",
226
+ "property": "grep",
227
+ "pattern": "who",
228
+ "flags": ["-l"],
229
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
230
+ "expected": [
231
+ "iliad.txt",
232
+ "paradise-lost.txt"
233
+ ]
234
+ },
235
+ {
236
+ "description": "Multiple files, several matches, case-insensitive flag",
237
+ "property": "grep",
238
+ "pattern": "TO",
239
+ "flags": ["-i"],
240
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
241
+ "expected": [
242
+ "iliad.txt:Caused to Achaia's host, sent many a soul",
243
+ "iliad.txt:Illustrious into Ades premature,",
244
+ "iliad.txt:And Heroes gave (so stood the will of Jove)",
245
+ "iliad.txt:To dogs and to all ravening fowls a prey,",
246
+ "midsummer-night.txt:I do entreat your grace to pardon me.",
247
+ "midsummer-night.txt:In such a presence here to plead my thoughts;",
248
+ "midsummer-night.txt:If I refuse to wed Demetrius.",
249
+ "paradise-lost.txt:Brought Death into the World, and all our woe,",
250
+ "paradise-lost.txt:Restore us, and regain the blissful Seat,",
251
+ "paradise-lost.txt:Sing Heav'nly Muse, that on the secret top"
252
+ ]
253
+ },
254
+ {
255
+ "description": "Multiple files, several matches, inverted flag",
256
+ "property": "grep",
257
+ "pattern": "a",
258
+ "flags": ["-v"],
259
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
260
+ "expected": [
261
+ "iliad.txt:Achilles sing, O Goddess! Peleus' son;",
262
+ "iliad.txt:The noble Chief Achilles from the son",
263
+ "midsummer-night.txt:If I refuse to wed Demetrius."
264
+ ]
265
+ },
266
+ {
267
+ "description": "Multiple files, one match, match entire lines flag",
268
+ "property": "grep",
269
+ "pattern": "But I beseech your grace that I may know",
270
+ "flags": ["-x"],
271
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
272
+ "expected": [
273
+ "midsummer-night.txt:But I beseech your grace that I may know"
274
+ ]
275
+ },
276
+ {
277
+ "description": "Multiple files, one match, multiple flags",
278
+ "property": "grep",
279
+ "pattern": "WITH LOSS OF EDEN, TILL ONE GREATER MAN",
280
+ "flags": ["-n", "-i", "-x"],
281
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
282
+ "expected": [
283
+ "paradise-lost.txt:4:With loss of Eden, till one greater Man"
284
+ ]
285
+ },
286
+ {
287
+ "description": "Multiple files, no matches, various flags",
288
+ "property": "grep",
289
+ "pattern": "Frodo",
290
+ "flags": ["-n", "-l", "-x", "-i"],
291
+ "files": ["iliad.txt", "midsummer-night.txt", "paradise-lost.txt"],
292
+ "expected": []
293
+ }
294
+ ]
275
295
  }
276
- }
296
+ ]
297
+ }