alf-shell 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. data/Gemfile +5 -2
  2. data/Gemfile.lock +29 -10
  3. data/bin/alf +2 -0
  4. data/doc/man/alf-explain.man +22 -0
  5. data/doc/man/alf-metadata.man +13 -0
  6. data/doc/man/alf-show.man +16 -0
  7. data/doc/man/alf.man +77 -0
  8. data/doc/man/allbut.man +39 -0
  9. data/doc/man/among.man +25 -0
  10. data/doc/man/avg.man +37 -0
  11. data/doc/man/between.man +24 -0
  12. data/doc/man/concat.man +55 -0
  13. data/doc/man/contradiction.man +26 -0
  14. data/doc/man/count.man +20 -0
  15. data/doc/man/eq.man +29 -0
  16. data/doc/man/extend.man +33 -0
  17. data/doc/man/frame.man +60 -0
  18. data/doc/man/group.man +51 -0
  19. data/doc/man/gt.man +30 -0
  20. data/doc/man/gte.man +30 -0
  21. data/doc/man/intersect.man +54 -0
  22. data/doc/man/join.man +84 -0
  23. data/doc/man/lt.man +30 -0
  24. data/doc/man/lte.man +30 -0
  25. data/doc/man/matching.man +73 -0
  26. data/doc/man/max.man +36 -0
  27. data/doc/man/min.man +36 -0
  28. data/doc/man/minus.man +54 -0
  29. data/doc/man/native.man +32 -0
  30. data/doc/man/neq.man +29 -0
  31. data/doc/man/not_matching.man +51 -0
  32. data/doc/man/page.man +60 -0
  33. data/doc/man/project.man +36 -0
  34. data/doc/man/rank.man +42 -0
  35. data/doc/man/rename.man +29 -0
  36. data/doc/man/restrict.man +38 -0
  37. data/doc/man/stddev.man +37 -0
  38. data/doc/man/sum.man +37 -0
  39. data/doc/man/summarize.man +45 -0
  40. data/doc/man/tautology.man +26 -0
  41. data/doc/man/ungroup.man +30 -0
  42. data/doc/man/union.man +55 -0
  43. data/doc/man/unwrap.man +37 -0
  44. data/doc/man/variance.man +37 -0
  45. data/doc/man/wrap.man +37 -0
  46. data/doc/txt/alf-explain.man +22 -0
  47. data/doc/txt/alf-metadata.man +16 -0
  48. data/doc/txt/alf-show.man +19 -0
  49. data/doc/txt/alf.man +80 -0
  50. data/doc/txt/allbut.txt +31 -0
  51. data/doc/txt/among.txt +20 -0
  52. data/doc/txt/avg.txt +22 -0
  53. data/doc/txt/between.txt +19 -0
  54. data/doc/txt/concat.txt +31 -0
  55. data/doc/txt/contradiction.txt +15 -0
  56. data/doc/txt/count.txt +14 -0
  57. data/doc/txt/eq.txt +19 -0
  58. data/doc/txt/extend.txt +29 -0
  59. data/doc/txt/frame.txt +48 -0
  60. data/doc/txt/group.txt +37 -0
  61. data/doc/txt/gt.txt +20 -0
  62. data/doc/txt/gte.txt +20 -0
  63. data/doc/txt/intersect.txt +42 -0
  64. data/doc/txt/join.txt +65 -0
  65. data/doc/txt/lt.txt +20 -0
  66. data/doc/txt/lte.txt +20 -0
  67. data/doc/txt/matching.txt +54 -0
  68. data/doc/txt/max.txt +21 -0
  69. data/doc/txt/min.txt +21 -0
  70. data/doc/txt/minus.txt +42 -0
  71. data/doc/txt/native.txt +27 -0
  72. data/doc/txt/neq.txt +19 -0
  73. data/doc/txt/not_matching.txt +39 -0
  74. data/doc/txt/page.txt +48 -0
  75. data/doc/txt/project.txt +28 -0
  76. data/doc/txt/rank.txt +34 -0
  77. data/doc/txt/rename.txt +25 -0
  78. data/doc/txt/restrict.txt +26 -0
  79. data/doc/txt/stddev.txt +22 -0
  80. data/doc/txt/sum.txt +22 -0
  81. data/doc/txt/summarize.txt +33 -0
  82. data/doc/txt/tautology.txt +15 -0
  83. data/doc/txt/ungroup.txt +26 -0
  84. data/doc/txt/union.txt +43 -0
  85. data/doc/txt/unwrap.txt +29 -0
  86. data/doc/txt/variance.txt +22 -0
  87. data/doc/txt/wrap.txt +29 -0
  88. data/lib/alf/shell.rb +2 -32
  89. data/lib/alf/shell/alfrc.rb +3 -0
  90. data/lib/alf/shell/command.rb +2 -18
  91. data/lib/alf/shell/command/explain.rb +37 -0
  92. data/lib/alf/shell/command/help.rb +3 -21
  93. data/lib/alf/shell/command/main.rb +20 -78
  94. data/lib/alf/shell/command/metadata.rb +32 -0
  95. data/lib/alf/shell/command/show.rb +17 -5
  96. data/lib/alf/shell/support.rb +21 -13
  97. data/lib/alf/shell/version.rb +1 -1
  98. data/spec/integration/explain/explain.cmd +1 -0
  99. data/spec/integration/explain/explain.stdout +11 -0
  100. data/spec/integration/show/group.alf +2 -0
  101. data/spec/integration/show/show_alf.cmd +1 -0
  102. data/spec/integration/{group/group_0.stdout → show/show_alf.stdout} +0 -0
  103. data/tasks/doc.rake +4 -0
  104. metadata +116 -178
  105. data/doc/commands/exec.md +0 -16
  106. data/doc/commands/help.md +0 -11
  107. data/doc/commands/main.md +0 -33
  108. data/doc/commands/show.md +0 -12
  109. data/doc/operators/non_relational/autonum.md +0 -23
  110. data/doc/operators/non_relational/clip.md +0 -31
  111. data/doc/operators/non_relational/coerce.md +0 -15
  112. data/doc/operators/non_relational/compact.md +0 -20
  113. data/doc/operators/non_relational/defaults.md +0 -32
  114. data/doc/operators/non_relational/generator.md +0 -20
  115. data/doc/operators/non_relational/sort.md +0 -24
  116. data/doc/operators/non_relational/type-safe.md +0 -20
  117. data/doc/operators/relational/extend.md +0 -18
  118. data/doc/operators/relational/frame.md +0 -26
  119. data/doc/operators/relational/group.md +0 -27
  120. data/doc/operators/relational/hierarchize.md +0 -14
  121. data/doc/operators/relational/infer-heading.md +0 -20
  122. data/doc/operators/relational/intersect.md +0 -13
  123. data/doc/operators/relational/join.md +0 -28
  124. data/doc/operators/relational/matching.md +0 -24
  125. data/doc/operators/relational/minus.md +0 -12
  126. data/doc/operators/relational/not-matching.md +0 -20
  127. data/doc/operators/relational/page.md +0 -31
  128. data/doc/operators/relational/project.md +0 -28
  129. data/doc/operators/relational/quota.md +0 -21
  130. data/doc/operators/relational/rank.md +0 -27
  131. data/doc/operators/relational/rename.md +0 -17
  132. data/doc/operators/relational/restrict.md +0 -25
  133. data/doc/operators/relational/summarize.md +0 -25
  134. data/doc/operators/relational/ungroup.md +0 -20
  135. data/doc/operators/relational/union.md +0 -14
  136. data/doc/operators/relational/unwrap.md +0 -20
  137. data/doc/operators/relational/wrap.md +0 -24
  138. data/lib/alf/shell/command/exec.rb +0 -16
  139. data/lib/alf/shell/doc_manager.rb +0 -84
  140. data/lib/alf/shell/ext/signature.rb +0 -45
  141. data/lib/alf/shell/from_argv.rb +0 -84
  142. data/lib/alf/shell/operator.rb +0 -63
  143. data/spec/integration/__database__/group.alf +0 -3
  144. data/spec/integration/alf/alf_e.cmd +0 -1
  145. data/spec/integration/alf/alf_e.stdout +0 -4
  146. data/spec/integration/alf/alf_help.cmd +0 -1
  147. data/spec/integration/alf/alf_help.stdout +0 -76
  148. data/spec/integration/alf/alf_r.cmd +0 -1
  149. data/spec/integration/alf/alf_r.stdout +0 -5
  150. data/spec/integration/autonum/autonum_0.cmd +0 -1
  151. data/spec/integration/autonum/autonum_0.stdout +0 -9
  152. data/spec/integration/autonum/autonum_1.cmd +0 -1
  153. data/spec/integration/autonum/autonum_1.stdout +0 -9
  154. data/spec/integration/clip/clip_0.cmd +0 -1
  155. data/spec/integration/clip/clip_0.stdout +0 -9
  156. data/spec/integration/clip/clip_1.cmd +0 -1
  157. data/spec/integration/clip/clip_1.stdout +0 -9
  158. data/spec/integration/coerce/coerce_1.cmd +0 -1
  159. data/spec/integration/coerce/coerce_1.stdout +0 -5
  160. data/spec/integration/compact/compact_0.cmd +0 -1
  161. data/spec/integration/compact/compact_0.stdout +0 -9
  162. data/spec/integration/defaults/defaults_0.cmd +0 -1
  163. data/spec/integration/defaults/defaults_0.stdout +0 -9
  164. data/spec/integration/defaults/defaults_1.cmd +0 -1
  165. data/spec/integration/defaults/defaults_1.stdout +0 -9
  166. data/spec/integration/defaults/defaults_2.cmd +0 -1
  167. data/spec/integration/defaults/defaults_2.stdout +0 -9
  168. data/spec/integration/extend/extend_0.cmd +0 -1
  169. data/spec/integration/extend/extend_0.stdout +0 -16
  170. data/spec/integration/frame/frame_0.cmd +0 -1
  171. data/spec/integration/frame/frame_0.stdout +0 -6
  172. data/spec/integration/generator/generator_1.cmd +0 -1
  173. data/spec/integration/generator/generator_1.stdout +0 -10
  174. data/spec/integration/generator/generator_2.cmd +0 -1
  175. data/spec/integration/generator/generator_2.stdout +0 -5
  176. data/spec/integration/generator/generator_3.cmd +0 -1
  177. data/spec/integration/generator/generator_3.stdout +0 -5
  178. data/spec/integration/group/group_0.cmd +0 -1
  179. data/spec/integration/group/group_1.cmd +0 -1
  180. data/spec/integration/group/group_1.stdout +0 -32
  181. data/spec/integration/help/help_1.cmd +0 -1
  182. data/spec/integration/help/help_1.stdout +0 -12
  183. data/spec/integration/intersect/intersect_0.cmd +0 -1
  184. data/spec/integration/intersect/intersect_0.stdout +0 -9
  185. data/spec/integration/join/join_0.cmd +0 -1
  186. data/spec/integration/join/join_0.stdout +0 -16
  187. data/spec/integration/matching/matching_0.cmd +0 -1
  188. data/spec/integration/matching/matching_0.stdout +0 -8
  189. data/spec/integration/minus/minus_0.cmd +0 -1
  190. data/spec/integration/minus/minus_0.stdout +0 -4
  191. data/spec/integration/not-matching/not-matching_0.cmd +0 -1
  192. data/spec/integration/not-matching/not-matching_0.stdout +0 -5
  193. data/spec/integration/page/page_0.cmd +0 -1
  194. data/spec/integration/page/page_0.stdout +0 -6
  195. data/spec/integration/project/project_0.cmd +0 -1
  196. data/spec/integration/project/project_0.stdout +0 -9
  197. data/spec/integration/project/project_1.cmd +0 -1
  198. data/spec/integration/project/project_1.stdout +0 -9
  199. data/spec/integration/quota/quota_0.cmd +0 -1
  200. data/spec/integration/quota/quota_0.stdout +0 -16
  201. data/spec/integration/rank/rank_1.cmd +0 -1
  202. data/spec/integration/rank/rank_1.stdout +0 -10
  203. data/spec/integration/rank/rank_2.cmd +0 -1
  204. data/spec/integration/rank/rank_2.stdout +0 -10
  205. data/spec/integration/rank/rank_3.cmd +0 -1
  206. data/spec/integration/rank/rank_3.stdout +0 -10
  207. data/spec/integration/rank/rank_4.cmd +0 -1
  208. data/spec/integration/rank/rank_4.stdout +0 -6
  209. data/spec/integration/rank/rank_5.cmd +0 -1
  210. data/spec/integration/rank/rank_5.stdout +0 -6
  211. data/spec/integration/rename/rename_0.cmd +0 -1
  212. data/spec/integration/rename/rename_0.stdout +0 -9
  213. data/spec/integration/restrict/restrict_0.cmd +0 -1
  214. data/spec/integration/restrict/restrict_0.stdout +0 -6
  215. data/spec/integration/restrict/restrict_1.cmd +0 -1
  216. data/spec/integration/restrict/restrict_1.stdout +0 -6
  217. data/spec/integration/sort/sort_0.cmd +0 -1
  218. data/spec/integration/sort/sort_0.stdout +0 -9
  219. data/spec/integration/sort/sort_1.cmd +0 -1
  220. data/spec/integration/sort/sort_1.stdout +0 -9
  221. data/spec/integration/sort/sort_2.cmd +0 -1
  222. data/spec/integration/sort/sort_2.stdout +0 -9
  223. data/spec/integration/sort/sort_3.cmd +0 -1
  224. data/spec/integration/sort/sort_3.stdout +0 -9
  225. data/spec/integration/summarize/summarize_0.cmd +0 -1
  226. data/spec/integration/summarize/summarize_0.stdout +0 -8
  227. data/spec/integration/union/union_0.cmd +0 -1
  228. data/spec/integration/union/union_0.stdout +0 -9
  229. data/spec/integration/unwrap/unwrap_0.cmd +0 -1
  230. data/spec/integration/unwrap/unwrap_0.stdout +0 -9
  231. data/spec/integration/wrap/wrap_0.cmd +0 -1
  232. data/spec/integration/wrap/wrap_0.stdout +0 -9
  233. data/spec/unit/doc_manager/dynamic.md +0 -1
  234. data/spec/unit/doc_manager/example.md +0 -1
  235. data/spec/unit/doc_manager/example_1.txt +0 -11
  236. data/spec/unit/doc_manager/static.md +0 -1
  237. data/spec/unit/doc_manager/test_call.rb +0 -41
  238. data/spec/unit/ext/signature/test_argv2args.rb +0 -82
  239. data/spec/unit/ext/signature/test_to_shell.rb +0 -103
  240. data/spec/unit/from_argv/test_to_attr_list.rb +0 -30
  241. data/spec/unit/from_argv/test_to_attr_name.rb +0 -27
  242. data/spec/unit/from_argv/test_to_boolean.rb +0 -32
  243. data/spec/unit/from_argv/test_to_heading.rb +0 -37
  244. data/spec/unit/from_argv/test_to_ordering.rb +0 -28
  245. data/spec/unit/from_argv/test_to_predicate.rb +0 -26
  246. data/spec/unit/from_argv/test_to_renaming.rb +0 -23
  247. data/spec/unit/from_argv/test_to_size.rb +0 -32
  248. data/spec/unit/from_argv/test_to_summarization.rb +0 -19
  249. data/spec/unit/from_argv/test_to_tuple_computation.rb +0 -18
  250. data/spec/unit/from_argv/test_to_tuple_expression.rb +0 -38
  251. data/spec/unit/main/test_class_methods.rb +0 -44
  252. data/spec/unit/operator/test_autonum.rb +0 -28
  253. data/spec/unit/operator/test_clip.rb +0 -29
  254. data/spec/unit/operator/test_coerce.rb +0 -22
  255. data/spec/unit/operator/test_compact.rb +0 -16
  256. data/spec/unit/operator/test_defaults.rb +0 -29
  257. data/spec/unit/operator/test_extend.rb +0 -21
  258. data/spec/unit/operator/test_generator.rb +0 -37
  259. data/spec/unit/operator/test_group.rb +0 -32
  260. data/spec/unit/operator/test_infer_heading.rb +0 -16
  261. data/spec/unit/operator/test_intersect.rb +0 -18
  262. data/spec/unit/operator/test_join.rb +0 -18
  263. data/spec/unit/operator/test_matching.rb +0 -18
  264. data/spec/unit/operator/test_minus.rb +0 -18
  265. data/spec/unit/operator/test_not_matching.rb +0 -18
  266. data/spec/unit/operator/test_project.rb +0 -38
  267. data/spec/unit/operator/test_quota.rb +0 -23
  268. data/spec/unit/operator/test_rank.rb +0 -30
  269. data/spec/unit/operator/test_rename.rb +0 -21
  270. data/spec/unit/operator/test_restrict.rb +0 -36
  271. data/spec/unit/operator/test_sort.rb +0 -49
  272. data/spec/unit/operator/test_summarize.rb +0 -30
  273. data/spec/unit/operator/test_ungroup.rb +0 -28
  274. data/spec/unit/operator/test_union.rb +0 -18
  275. data/spec/unit/operator/test_unwrap.rb +0 -28
  276. data/spec/unit/operator/test_wrap.rb +0 -30
@@ -1,82 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- module Algebra
4
- describe Signature, "#argv2args" do
5
-
6
- class FakeOp
7
- attr_accessor :operands
8
- end
9
- before{
10
- signature.install
11
- }
12
- subject{
13
- signature.argv2args(argv)
14
- }
15
-
16
- context "on a signature with arguments only" do
17
- let(:signature){
18
- Signature.new(FakeOp) do |s|
19
- s.argument :proj, AttrList
20
- end
21
- }
22
- let(:argv){ %w{operand -- hello world} }
23
-
24
- it 'should return the expected triple' do
25
- [["operand"], [AttrList[:hello, :world]], {}]
26
- end
27
- end # arguments only
28
-
29
- context "with default values for arguments" do
30
- let(:signature){
31
- Signature.new(FakeOp) do |s|
32
- s.argument :attrname, AttrName, :autonum
33
- end
34
- }
35
- let(:arguments){ subject[1] }
36
-
37
- context 'and passed' do
38
- let(:argv){ %w{operand -- hello} }
39
-
40
- it 'should not use the default value' do
41
- arguments.should eq([:hello])
42
- end
43
- end
44
-
45
- context 'and not passed' do
46
- let(:argv){ %w{operand} }
47
-
48
- it 'should use the default value' do
49
- arguments.should eq([:autonum])
50
- end
51
- end
52
- end # default values for arguments
53
-
54
- context "on a signature with options" do
55
- let(:signature){
56
- Signature.new(FakeOp) do |s|
57
- s.argument :key, AttrList, []
58
- s.option :allbut, Boolean, false
59
- end
60
- }
61
- let(:options){ subject[2] }
62
-
63
- context "when no option is provided" do
64
- let(:argv){ %w{operand -- hello world} }
65
-
66
- it 'should use the default values for options' do
67
- options.should eq({:allbut => false})
68
- end
69
- end
70
-
71
- context "when option is provided" do
72
- let(:argv){ %w{operand --allbut -- hello world} }
73
-
74
- it 'should not use the default values for options' do
75
- options.should eq({:allbut => true})
76
- end
77
- end
78
- end # signature with options
79
-
80
- end
81
- end
82
- end
@@ -1,103 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- module Algebra
4
- describe Signature, '#to_shell' do
5
-
6
- subject{ signature.to_shell }
7
-
8
- describe "on a nullary signature" do
9
- let(:clazz){ Generator }
10
-
11
- describe "on an empty signature" do
12
- let(:signature){ Signature.new(clazz){|s|} }
13
- it{ should eq("alf generator") }
14
- end
15
-
16
- describe "on an option-only signature" do
17
- let(:signature){
18
- Signature.new(clazz) do |s|
19
- s.option :allbut, Boolean
20
- end
21
- }
22
- it{ should eq("alf generator [--allbut]") }
23
- end
24
-
25
- end # nullary signature
26
-
27
- describe "on a monadic operator" do
28
- let(:clazz){ Coerce }
29
-
30
- describe "on an empty signature" do
31
- let(:signature){ Signature.new(clazz){|s|} }
32
- it{ should eq("alf coerce [OPERAND]") }
33
- end
34
-
35
- describe "on an option-only signature" do
36
- let(:signature){
37
- Signature.new(clazz) do |s|
38
- s.option :allbut, Boolean
39
- end
40
- }
41
- it{ should eq("alf coerce [--allbut] [OPERAND]") }
42
- end
43
-
44
- describe "on an option-only signature with multiple options" do
45
- let(:signature){
46
- Signature.new(clazz) do |s|
47
- s.option :allbut, Boolean
48
- s.option :newname, AttrName
49
- end
50
- }
51
- it{ should eq("alf coerce [--allbut] [--newname=NEWNAME] [OPERAND]") }
52
- end
53
-
54
- describe "on a signature with one argument only" do
55
- let(:signature){
56
- Signature.new(clazz) do |s|
57
- s.argument :proj, AttrList
58
- end
59
- }
60
- it{ should eq("alf coerce [OPERAND] -- PROJ") }
61
- end
62
-
63
- describe "on a signature with multiple arguments" do
64
- let(:signature){
65
- Signature.new(clazz) do |s|
66
- s.argument :proj, AttrList
67
- s.argument :ordering, Ordering
68
- end
69
- }
70
- it{ should eq("alf coerce [OPERAND] -- PROJ -- ORDERING") }
71
- end
72
-
73
- describe "on a full signature" do
74
- let(:signature){
75
- Signature.new(clazz) do |s|
76
- s.argument :proj, AttrList
77
- s.argument :ordering, Ordering
78
- s.option :allbut, Boolean
79
- s.option :newname, AttrName
80
- end
81
- }
82
- it{ should eq("alf coerce [--allbut] [--newname=NEWNAME] [OPERAND] -- PROJ -- ORDERING") }
83
- end
84
-
85
- end
86
-
87
- describe "on a dyadic operator" do
88
- let(:clazz){ Join }
89
-
90
- describe "on an option-only signature" do
91
- let(:signature){
92
- Signature.new(clazz) do |s|
93
- s.option :allbut, Boolean
94
- end
95
- }
96
- it{ should eq("alf join [--allbut] [LEFT] RIGHT") }
97
- end
98
-
99
- end
100
-
101
- end
102
- end
103
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, AttrList)" do
4
-
5
- subject{ Shell.from_argv(argv, AttrList) }
6
-
7
- context "on an empty array" do
8
- let(:argv){ [] }
9
- it{ should eq(AttrList.new([])) }
10
- end
11
-
12
- context "on a singleton" do
13
- let(:argv){ ["hello"] }
14
- it{ should eq(AttrList.new([:hello])) }
15
- end
16
-
17
- context "on multiple strings" do
18
- let(:argv){ ["hello", "world"] }
19
- it{ should eq(AttrList.new([:hello, :world])) }
20
- end
21
-
22
- context "when passed an unrecognized argument" do
23
- let(:argv){ :not_recognized }
24
- specify{
25
- lambda{ subject }.should raise_error(Myrrha::Error)
26
- }
27
- end
28
-
29
- end
30
- end
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, AttrName)" do
4
-
5
- subject{ Shell.from_argv(argv, AttrName) }
6
-
7
- context "with a String" do
8
- let(:argv){ %w{hello} }
9
- it{ should eq(:hello) }
10
- end
11
-
12
- context "with nothing" do
13
- let(:argv){ %w{} }
14
- specify{
15
- lambda{ subject }.should raise_error(Myrrha::Error)
16
- }
17
- end
18
-
19
- context "with more than one string" do
20
- let(:argv){ %w{hello world} }
21
- specify{
22
- lambda{ subject }.should raise_error(Myrrha::Error)
23
- }
24
- end
25
-
26
- end
27
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, Boolean)" do
4
-
5
- subject{ Shell.from_argv(argv, Boolean) }
6
-
7
- context "with a String" do
8
- let(:argv){ %w{true} }
9
- it{ should eq(true) }
10
- end
11
-
12
- context "with nothing" do
13
- let(:argv){ %w{} }
14
- it{ should eq(false) }
15
- end
16
-
17
- context "with an invalid string" do
18
- let(:argv){ %w{hello} }
19
- specify{
20
- lambda{ subject }.should raise_error(Myrrha::Error)
21
- }
22
- end
23
-
24
- context "with more than one string" do
25
- let(:argv){ %w{hello world} }
26
- specify{
27
- lambda{ subject }.should raise_error(Myrrha::Error)
28
- }
29
- end
30
-
31
- end
32
- end
@@ -1,37 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, Heading)" do
4
-
5
- subject{ Shell.from_argv(argv, Heading) }
6
-
7
- context "on an empty array" do
8
- let(:argv){ [] }
9
- it{ should eq(Heading.new({})) }
10
- end
11
-
12
- context "on a single pair" do
13
- let(:argv){ ["name", "String"] }
14
- it{ should eq(Heading.new :name => String) }
15
- end
16
-
17
- context "on a double pair" do
18
- let(:argv){ ["name", "String", "age", "Fixnum"] }
19
- it{ should eq(Heading.new :name => String, :age => Fixnum) }
20
- end
21
-
22
- context "on odd number of strings" do
23
- let(:argv){ ["hello", "world", "foo"] }
24
- specify{
25
- lambda{ subject }.should raise_error(Myrrha::Error)
26
- }
27
- end
28
-
29
- context "when passed an unrecognized argument" do
30
- let(:argv){ :not_recognized }
31
- specify{
32
- lambda{ subject }.should raise_error(Myrrha::Error)
33
- }
34
- end
35
-
36
- end
37
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, Ordering)" do
4
-
5
- subject{ Shell.from_argv(argv, Ordering) }
6
-
7
- context "on an empty array" do
8
- let(:argv){ [] }
9
- it{ should eq(Ordering.new([])) }
10
- end
11
-
12
- context "on a singleton" do
13
- let(:argv){ ["hello"] }
14
- it{ should eq(Ordering.new([[:hello, :asc]])) }
15
- end
16
-
17
- context "on multiple strings without explit directions" do
18
- let(:argv){ ["hello", "world"] }
19
- it{ should eq(Ordering.new([[:hello, :asc], [:world, :asc]])) }
20
- end
21
-
22
- context "on multiple strings with explit directions" do
23
- let(:argv){ ["hello", "asc", "world", "desc"] }
24
- it{ should eq(Ordering.new([[:hello, :asc], [:world, :desc]])) }
25
- end
26
-
27
- end
28
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, Predicate)" do
4
-
5
- subject{ Shell.from_argv(argv, Predicate) }
6
-
7
- describe "from a singleton Array" do
8
- let(:argv){ ["status == 10"] }
9
-
10
- specify{
11
- subject.expr.should be_a(Predicate::Native)
12
- subject.to_ruby_literal.should eq("lambda{ status == 10 }")
13
- }
14
- end
15
-
16
- describe "from an Array with coercion" do
17
- let(:argv){ ["status", "10"] }
18
-
19
- specify{
20
- subject.expr.should be_a(Predicate::Eq)
21
- subject.expr.should eq([:eq, [:var_ref, :status], [:literal, 10]])
22
- }
23
- end
24
-
25
- end
26
- end
@@ -1,23 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, Renaming)" do
4
-
5
- subject{ Shell.from_argv(argv, Renaming) }
6
-
7
- context "from an empty Array" do
8
- let(:argv){ [] }
9
- it{ should eq(Renaming.new({})) }
10
- end
11
-
12
- context "from an Array of two elements" do
13
- let(:argv){ ["old", "new"] }
14
- it{ should eq(Renaming.new(:old => :new)) }
15
- end
16
-
17
- context "from an Array of four elements" do
18
- let(:argv){ ["old", "new", "hello", "world"] }
19
- it{ should eq(Renaming.new(:old => :new, :hello => :world)) }
20
- end
21
-
22
- end
23
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, Size)" do
4
-
5
- subject{ Shell.from_argv(argv, Size) }
6
-
7
- context 'on an empty array' do
8
- let(:argv){ [ ] }
9
- it{ should eq(0) }
10
- end
11
-
12
- context 'with a single string' do
13
- let(:argv){ [ "12" ] }
14
- it{ should eq(12) }
15
- end
16
-
17
- context 'on a big array' do
18
- let(:argv){ ["12", "hello"] }
19
- specify{
20
- lambda{ subject }.should raise_error(Myrrha::Error)
21
- }
22
- end
23
-
24
- context 'when not coercable' do
25
- let(:argv){ ["hello"] }
26
- specify{
27
- lambda{ subject }.should raise_error(Myrrha::Error)
28
- }
29
- end
30
-
31
- end
32
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Shell, ".from_argv(argv, Summarization)" do
4
-
5
- subject{ Shell.from_argv(argv, Summarization) }
6
-
7
- context "from an Array" do
8
- let(:argv){ ["s", "sum{ qty }", "m", "max{ size }"] }
9
-
10
- it{ should be_a(Summarization) }
11
-
12
- specify{
13
- subject.to_hash.keys.to_set.should eq([:s, :m].to_set)
14
- subject.to_hash.values.all?{|v| v.should be_a(Aggregator)}
15
- }
16
- end
17
-
18
- end
19
- end