activefacts 1.6.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +14 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +60 -0
  8. data/Rakefile +3 -80
  9. data/activefacts.gemspec +36 -0
  10. data/bin/afgen +4 -2
  11. data/bin/cql +5 -1
  12. data/lib/activefacts.rb +3 -12
  13. data/lib/activefacts/{vocabulary/query_evaluator.rb → query/evaluator.rb} +0 -0
  14. data/lib/activefacts/version.rb +2 -2
  15. metadata +48 -296
  16. data/History.txt +0 -4
  17. data/LICENSE +0 -19
  18. data/Manifest.txt +0 -165
  19. data/README.rdoc +0 -81
  20. data/css/offline.css +0 -3
  21. data/css/orm2.css +0 -124
  22. data/css/print.css +0 -8
  23. data/css/style-print.css +0 -357
  24. data/css/style.css +0 -387
  25. data/download.html +0 -110
  26. data/examples/CQL/Address.cql +0 -44
  27. data/examples/CQL/Blog.cql +0 -54
  28. data/examples/CQL/CompanyDirectorEmployee.cql +0 -56
  29. data/examples/CQL/Death.cql +0 -17
  30. data/examples/CQL/Diplomacy.cql +0 -48
  31. data/examples/CQL/Genealogy.cql +0 -98
  32. data/examples/CQL/Insurance.cql +0 -320
  33. data/examples/CQL/Marriage.cql +0 -18
  34. data/examples/CQL/Metamodel.cql +0 -493
  35. data/examples/CQL/Monogamy.cql +0 -24
  36. data/examples/CQL/MultiInheritance.cql +0 -22
  37. data/examples/CQL/NonRoleId.cql +0 -14
  38. data/examples/CQL/OddIdentifier.cql +0 -18
  39. data/examples/CQL/OilSupply.cql +0 -53
  40. data/examples/CQL/OneToOnes.cql +0 -17
  41. data/examples/CQL/Orienteering.cql +0 -111
  42. data/examples/CQL/PersonPlaysGame.cql +0 -18
  43. data/examples/CQL/RedundantDependency.cql +0 -34
  44. data/examples/CQL/SchoolActivities.cql +0 -33
  45. data/examples/CQL/SeparateSubtype.cql +0 -30
  46. data/examples/CQL/ServiceDirector.cql +0 -276
  47. data/examples/CQL/SimplestUnary.cql +0 -12
  48. data/examples/CQL/Supervision.cql +0 -34
  49. data/examples/CQL/WaiterTips.cql +0 -33
  50. data/examples/CQL/Warehousing.cql +0 -101
  51. data/examples/CQL/WindowInRoomInBldg.cql +0 -28
  52. data/examples/CQL/unit.cql +0 -474
  53. data/examples/index.html +0 -420
  54. data/examples/intro.html +0 -327
  55. data/examples/local.css +0 -24
  56. data/index.html +0 -111
  57. data/lib/activefacts/cql.rb +0 -35
  58. data/lib/activefacts/cql/CQLParser.treetop +0 -158
  59. data/lib/activefacts/cql/Context.treetop +0 -48
  60. data/lib/activefacts/cql/Expressions.treetop +0 -67
  61. data/lib/activefacts/cql/FactTypes.treetop +0 -358
  62. data/lib/activefacts/cql/Language/English.treetop +0 -315
  63. data/lib/activefacts/cql/LexicalRules.treetop +0 -253
  64. data/lib/activefacts/cql/ObjectTypes.treetop +0 -210
  65. data/lib/activefacts/cql/Rakefile +0 -14
  66. data/lib/activefacts/cql/Terms.treetop +0 -183
  67. data/lib/activefacts/cql/ValueTypes.treetop +0 -202
  68. data/lib/activefacts/cql/compiler.rb +0 -156
  69. data/lib/activefacts/cql/compiler/clause.rb +0 -1137
  70. data/lib/activefacts/cql/compiler/constraint.rb +0 -581
  71. data/lib/activefacts/cql/compiler/entity_type.rb +0 -457
  72. data/lib/activefacts/cql/compiler/expression.rb +0 -443
  73. data/lib/activefacts/cql/compiler/fact.rb +0 -390
  74. data/lib/activefacts/cql/compiler/fact_type.rb +0 -421
  75. data/lib/activefacts/cql/compiler/query.rb +0 -106
  76. data/lib/activefacts/cql/compiler/shared.rb +0 -161
  77. data/lib/activefacts/cql/compiler/value_type.rb +0 -174
  78. data/lib/activefacts/cql/nodes.rb +0 -49
  79. data/lib/activefacts/cql/parser.rb +0 -241
  80. data/lib/activefacts/dependency_analyser.rb +0 -182
  81. data/lib/activefacts/generate/absorption.rb +0 -70
  82. data/lib/activefacts/generate/composition.rb +0 -118
  83. data/lib/activefacts/generate/cql.rb +0 -714
  84. data/lib/activefacts/generate/dm.rb +0 -279
  85. data/lib/activefacts/generate/help.rb +0 -64
  86. data/lib/activefacts/generate/helpers/inject.rb +0 -16
  87. data/lib/activefacts/generate/helpers/oo.rb +0 -162
  88. data/lib/activefacts/generate/helpers/ordered.rb +0 -605
  89. data/lib/activefacts/generate/helpers/rails.rb +0 -57
  90. data/lib/activefacts/generate/html/glossary.rb +0 -461
  91. data/lib/activefacts/generate/json.rb +0 -337
  92. data/lib/activefacts/generate/null.rb +0 -32
  93. data/lib/activefacts/generate/rails/models.rb +0 -246
  94. data/lib/activefacts/generate/rails/schema.rb +0 -216
  95. data/lib/activefacts/generate/records.rb +0 -46
  96. data/lib/activefacts/generate/ruby.rb +0 -133
  97. data/lib/activefacts/generate/sql/mysql.rb +0 -280
  98. data/lib/activefacts/generate/sql/server.rb +0 -273
  99. data/lib/activefacts/generate/stats.rb +0 -69
  100. data/lib/activefacts/generate/text.rb +0 -27
  101. data/lib/activefacts/generate/topics.rb +0 -265
  102. data/lib/activefacts/generate/traits/datavault.rb +0 -241
  103. data/lib/activefacts/generate/traits/oo.rb +0 -73
  104. data/lib/activefacts/generate/traits/ordered.rb +0 -33
  105. data/lib/activefacts/generate/traits/ruby.rb +0 -210
  106. data/lib/activefacts/generate/transform/datavault.rb +0 -266
  107. data/lib/activefacts/generate/transform/surrogate.rb +0 -214
  108. data/lib/activefacts/generate/version.rb +0 -26
  109. data/lib/activefacts/input/cql.rb +0 -43
  110. data/lib/activefacts/input/orm.rb +0 -1636
  111. data/lib/activefacts/mapping/rails.rb +0 -132
  112. data/lib/activefacts/persistence.rb +0 -15
  113. data/lib/activefacts/persistence/columns.rb +0 -446
  114. data/lib/activefacts/persistence/foreignkey.rb +0 -187
  115. data/lib/activefacts/persistence/index.rb +0 -240
  116. data/lib/activefacts/persistence/object_type.rb +0 -198
  117. data/lib/activefacts/persistence/reference.rb +0 -434
  118. data/lib/activefacts/persistence/tables.rb +0 -380
  119. data/lib/activefacts/registry.rb +0 -11
  120. data/lib/activefacts/support.rb +0 -132
  121. data/lib/activefacts/vocabulary.rb +0 -9
  122. data/lib/activefacts/vocabulary/extensions.rb +0 -1348
  123. data/lib/activefacts/vocabulary/metamodel.rb +0 -570
  124. data/lib/activefacts/vocabulary/verbaliser.rb +0 -804
  125. data/script/txt2html +0 -71
  126. data/spec/absorption_spec.rb +0 -95
  127. data/spec/cql/comparison_spec.rb +0 -89
  128. data/spec/cql/context_spec.rb +0 -94
  129. data/spec/cql/contractions_spec.rb +0 -224
  130. data/spec/cql/deontic_spec.rb +0 -88
  131. data/spec/cql/entity_type_spec.rb +0 -320
  132. data/spec/cql/expressions_spec.rb +0 -66
  133. data/spec/cql/fact_type_matching_spec.rb +0 -338
  134. data/spec/cql/french_spec.rb +0 -21
  135. data/spec/cql/parser/bad_literals_spec.rb +0 -86
  136. data/spec/cql/parser/constraints_spec.rb +0 -19
  137. data/spec/cql/parser/entity_types_spec.rb +0 -106
  138. data/spec/cql/parser/expressions_spec.rb +0 -199
  139. data/spec/cql/parser/fact_types_spec.rb +0 -44
  140. data/spec/cql/parser/literals_spec.rb +0 -312
  141. data/spec/cql/parser/pragmas_spec.rb +0 -89
  142. data/spec/cql/parser/value_types_spec.rb +0 -42
  143. data/spec/cql/role_matching_spec.rb +0 -148
  144. data/spec/cql/samples_spec.rb +0 -244
  145. data/spec/cql_cql_spec.rb +0 -73
  146. data/spec/cql_dm_spec.rb +0 -136
  147. data/spec/cql_mysql_spec.rb +0 -69
  148. data/spec/cql_parse_spec.rb +0 -34
  149. data/spec/cql_ruby_spec.rb +0 -73
  150. data/spec/cql_sql_spec.rb +0 -72
  151. data/spec/cql_symbol_tables_spec.rb +0 -261
  152. data/spec/cqldump_spec.rb +0 -170
  153. data/spec/helpers/array_matcher.rb +0 -23
  154. data/spec/helpers/ctrl_c_support.rb +0 -52
  155. data/spec/helpers/diff_matcher.rb +0 -39
  156. data/spec/helpers/file_matcher.rb +0 -34
  157. data/spec/helpers/parse_to_ast_matcher.rb +0 -80
  158. data/spec/helpers/string_matcher.rb +0 -30
  159. data/spec/helpers/test_parser.rb +0 -15
  160. data/spec/norma_cql_spec.rb +0 -66
  161. data/spec/norma_ruby_spec.rb +0 -62
  162. data/spec/norma_ruby_sql_spec.rb +0 -107
  163. data/spec/norma_sql_spec.rb +0 -57
  164. data/spec/norma_tables_spec.rb +0 -95
  165. data/spec/ruby_api_spec.rb +0 -23
  166. data/spec/spec_helper.rb +0 -35
  167. data/spec/transform_surrogate_spec.rb +0 -59
  168. data/status.html +0 -138
  169. data/why.html +0 -60
@@ -1,338 +0,0 @@
1
- #
2
- # ActiveFacts CQL Fact Type matching tests
3
- # Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
4
- #
5
- $: << Dir::getwd
6
-
7
- require 'rspec/expectations'
8
-
9
- require 'activefacts/support'
10
- require 'activefacts/api/support'
11
- require 'activefacts/cql/compiler'
12
- require File.dirname(__FILE__) + '/../helpers/compile_helpers'
13
-
14
- describe "When matching a reading" do
15
- before :each do
16
- extend CompileHelpers
17
-
18
- prefix = %q{
19
- vocabulary Tests;
20
- Boy is written as String;
21
- Girl is written as Integer;
22
- }
23
- @compiler = ActiveFacts::CQL::Compiler.new('Test')
24
- @compiler.compile(prefix)
25
- @compiler.vocabulary.finalise
26
- @constellation = @compiler.vocabulary.constellation
27
-
28
- baseline
29
- end
30
-
31
- describe "with no existing fact type" do
32
- it "should create a simple fact type" do
33
- compile %q{Girl is going out with at most one Boy; }
34
- (new_fact_types = fact_types).size.should == 1
35
- (fact_type = new_fact_types[0]).all_reading.size.should == 1
36
- (pcs = fact_pcs(fact_type)).size.should == 1
37
- end
38
-
39
- it "should create a simple fact type using an explicit adjective" do
40
- compile %q{Girl is going out with at most one ugly-Boy;}
41
- (new_fact_types = fact_types).size.should == 1
42
- (fact_type = new_fact_types[0]).all_reading.size.should == 1
43
- (pcs = fact_pcs(fact_type)).size.should == 1
44
- end
45
- end
46
-
47
- describe "on an existing fact type" do
48
- before :each do
49
- #debug_enable("binding"); debug_enable("matching"); debug_enable("matching_fails"); debug_enable("parse")
50
- end
51
- after :each do
52
- #debug_disable("binding"); debug_disable("matching"); debug_disable("matching_fails"); debug_disable("parse")
53
- end
54
-
55
- describe "with no adjectives or role names" do
56
- before :each do
57
- compile %q{Girl is going out with at most one Boy;}
58
- # baseline
59
- end
60
-
61
- it "should recognise and add a reading" do
62
- compile %q{
63
- Girl is going out with Boy,
64
- Boy is going out with Girl;
65
- }
66
- (new_fact_types = fact_types).size.should == 1
67
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
68
- (pcs = fact_pcs(fact_type)).size.should == 1
69
- end
70
-
71
- it "should remove duplicate new readings" do
72
- skip("duplicate new clauses cause an error") do
73
- compile %q{
74
- Girl is going out with Boy,
75
- Girl is going out with Boy,
76
- Boy is going out with Girl,
77
- Boy is going out with Girl;
78
- }
79
- (new_fact_types = fact_types).size.should == 1
80
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
81
- (pcs = fact_pcs(fact_type)).size.should == 1
82
- end
83
- end
84
-
85
- it "should add new presence constraints" do
86
- compile %q{
87
- Girl is going out with Boy,
88
- Boy is going out with at most one Girl;
89
- }
90
- (new_fact_types = fact_types).size.should == 1
91
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
92
- (pcs = fact_pcs(fact_type)).size.should == 2
93
- end
94
-
95
- it "should add a new reading with a hyphenated word" do
96
- compile %q{
97
- Girl is going out with Boy,
98
- Boy is out driving a semi-trailer with Girl;
99
- }
100
- (new_fact_types = fact_types).size.should == 1
101
- (readings = (fact_type = new_fact_types[0]).all_reading.to_a).size.should == 2
102
- readings.detect{|r| r.text =~ /semi-trailer/}.should be_truthy
103
- (pcs = fact_pcs(fact_type)).size.should == 1
104
- end
105
-
106
- end
107
-
108
- describe "with role names" do
109
- before :each do
110
- compile %q{Girl (as Girlfriend) is going out with at most one Boy;}
111
- # baseline
112
- end
113
-
114
- it "should match role names" do
115
- skip("duplicate new clauses cause an error") do
116
- compile %q{
117
- Girl (as Girlfriend) is going out with Boy,
118
- Boy is going out with Girlfriend;
119
- }
120
- (new_fact_types = fact_types).size.should == 1
121
- (fact_type = new_fact_types[0]).all_reading.size.should == 3
122
- (pcs = fact_pcs(fact_type)).size.should == 2
123
- end
124
- end
125
- end
126
-
127
- describe "with a leading adjective" do
128
- before :each do
129
- compile %q{Girl is going out with at most one ugly-Boy;}
130
- @fact_type = fact_types[0]
131
- @initial_reading = fact_readings(@fact_type)[0]
132
- # baseline
133
- end
134
-
135
- it "should not match without the adjective" do
136
- baseline
137
- compile %q{
138
- Girl is going out with at most one Boy,
139
- Boy is best friend of Girl;
140
- }
141
- (new_fact_types = fact_types).size.should == 1
142
- new_fact_types[0].all_reading.size.should == 2
143
- fact_pcs(new_fact_types[0]).size.should == 1
144
- end
145
-
146
- it "should not match without the adjective and with the new reading first" do
147
- baseline
148
- compile %q{
149
- Boy is best friend of Girl,
150
- Girl is going out with at most one Boy;
151
- }
152
- (new_fact_types = fact_types).size.should == 1
153
- new_fact_types[0].all_reading.size.should == 2
154
- fact_pcs(new_fact_types[0]).size.should == 1
155
- end
156
-
157
- it "should match using explicit adjective" do
158
- compile %q{
159
- Girl is going out with at most one ugly-Boy,
160
- Boy is best friend of Girl;
161
- }
162
- (new_fact_types = fact_types).size.should == 1
163
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
164
- (pcs = fact_pcs(fact_type)).size.should == 1
165
- end
166
-
167
- it "should match using implicit adjective" do
168
- compile %q{
169
- Girl is going out with ugly Boy,
170
- ugly-Boy is best friend of Girl;
171
- }
172
- (new_fact_types = fact_types).size.should == 1
173
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
174
- (pcs = fact_pcs(fact_type)).size.should == 1
175
- end
176
-
177
- it "should match using implicit adjective and new explicit trailing adjective" do
178
- compile %q{
179
- Girl is going out with ugly Boy-monster,
180
- Boy monster is going out with Girl;
181
- }
182
- (new_fact_types = fact_types).size.should == 1
183
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
184
- new_reading = (fact_readings(@fact_type) - [@initial_reading])[0]
185
- new_reading.text.should == "{0} is going out with {1}"
186
- new_reading.role_sequence.all_role_ref_in_order[0].trailing_adjective.should == "monster"
187
- (pcs = fact_pcs(fact_type)).size.should == 1
188
- end
189
- end
190
-
191
- describe "with a trailing adjective" do
192
- before :each do
193
- compile %q{Girl is going out with at most one Boy-monster;}
194
- # baseline
195
- end
196
-
197
- it "should match using explicit adjective" do
198
- compile %q{
199
- Girl is going out with Boy-monster,
200
- Boy is going out with Girl;
201
- }
202
- (new_fact_types = fact_types).size.should == 1
203
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
204
- (pcs = fact_pcs(fact_type)).size.should == 1
205
- end
206
-
207
- it "should match using implicit adjective" do
208
- compile %q{
209
- Girl is going out with Boy monster,
210
- Boy is going out with Girl;
211
- }
212
- (new_fact_types = fact_types).size.should == 1
213
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
214
- (pcs = fact_pcs(fact_type)).size.should == 1
215
- end
216
-
217
- it "should match using implicit adjective and new explicit leading adjective" do
218
- baseline
219
- compile %q{
220
- Girl is going out with ugly-Boy monster,
221
- Boy is going out with Girl;
222
- }
223
- @compiler.vocabulary.finalise
224
- (new_fact_types = fact_types).size.should == 1
225
- fact_type = new_fact_types[0]
226
- fact_type.all_reading.size.should == 2
227
- (pcs = fact_pcs(fact_type)).size.should == 1
228
- end
229
- end
230
-
231
- describe "with double adjectives" do
232
- before :each do
233
- compile %q{Girl is going out with at most one ugly- bad Boy;}
234
- # baseline
235
- end
236
-
237
- it "should match using explicit adjectives" do
238
- compile %q{
239
- Girl is going out with ugly- bad Boy,
240
- ugly- bad Boy is going out with Girl;
241
- }
242
- (new_fact_types = fact_types).size.should == 1
243
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
244
- (pcs = fact_pcs(fact_type)).size.should == 1
245
- end
246
-
247
- it "should match using implicit adjectives" do
248
- compile %q{
249
- Girl is going out with ugly bad Boy,
250
- nasty- ugly bad Boy is going out with Girl;
251
- }
252
- (new_fact_types = fact_types).size.should == 1
253
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
254
- (pcs = fact_pcs(fact_type)).size.should == 1
255
- end
256
- end
257
-
258
- describe "with double trailing adjectives" do
259
- before :each do
260
- compile %q{Girl is going out with at most one Boy real -monster;}
261
- # baseline
262
- end
263
-
264
- it "should match using explicit adjectives" do
265
- compile %q{
266
- Girl is going out with Boy real -monster,
267
- Boy is going out with Girl;
268
- }
269
- (new_fact_types = fact_types).size.should == 1
270
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
271
- (pcs = fact_pcs(fact_type)).size.should == 1
272
- end
273
-
274
- it "should match using implicit adjectives" do
275
- compile %q{
276
- Girl is going out with Boy real monster,
277
- Boy is going out with Girl;
278
- }
279
- (new_fact_types = fact_types).size.should == 1
280
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
281
- (pcs = fact_pcs(fact_type)).size.should == 1
282
- end
283
- end
284
-
285
- describe "with hyphenated adjectives" do
286
- before :each do
287
- compile %q{Girl is going out with at most one butt-- ugly Boy;}
288
- # baseline
289
- end
290
-
291
- it "should compile them correctly" do
292
- (new_fact_types = fact_types).size.should == 1
293
- (readings = new_fact_types[0].all_reading).size.should == 1
294
- (role_refs = readings.single.role_sequence.all_role_ref).size.should == 2
295
- (boy_role_ref = role_refs.sort_by{|rr| rr.ordinal}[1])
296
- boy_role_ref.leading_adjective.should == 'butt-ugly'
297
- end
298
-
299
- it "should match using explicit adjectives" do
300
- compile %q{
301
- Girl is going out with butt-- ugly Boy,
302
- butt-ugly Boy is going out with Girl;
303
- }
304
- (new_fact_types = fact_types).size.should == 1
305
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
306
- (pcs = fact_pcs(fact_type)).size.should == 1
307
- # REVISIT: Check new and existing reading
308
- end
309
-
310
- it "should match using implicit adjectives" do
311
- compile %q{
312
- Girl is going out with butt-- ugly Boy,
313
- butt-ugly Boy is going out with Girl;
314
- }
315
- (new_fact_types = fact_types).size.should == 1
316
- (fact_type = new_fact_types[0]).all_reading.size.should == 2
317
- (pcs = fact_pcs(fact_type)).size.should == 1
318
- # REVISIT: Check new and existing reading
319
- end
320
- end
321
-
322
- describe "with hyphenated trailing adjectives" do
323
- before :each do
324
- compile %q{Girl is going out with at most one Boy tres --gross;}
325
- # baseline
326
- end
327
-
328
- it "should compile them correctly" do
329
- (new_fact_types = fact_types).size.should == 1
330
- (readings = new_fact_types[0].all_reading).size.should == 1
331
- (role_refs = readings.single.role_sequence.all_role_ref).size.should == 2
332
- (boy_role_ref = role_refs.sort_by{|rr| rr.ordinal}[1])
333
- boy_role_ref.trailing_adjective.should == 'tres-gross'
334
- end
335
-
336
- end
337
- end
338
- end
@@ -1,21 +0,0 @@
1
-
2
-
3
- # Examples:
4
- #
5
- # Company has at most one postal-Address;
6
- # CompanyContact is where Company has contact-Person;
7
- # CompanyContact is the situation where Company has contact-Person;
8
- # for each Company at least one of the following holds:
9
- # that Company has some contact-Person,
10
- # that Company has some mailing-Address and that mailing-Address includes PostCode;
11
- #
12
- # Entreprise is a synonym for English:Company;
13
- # Entreprise est un synonyme pour English:Company;
14
- # Personne is a synonym for English:Person;
15
- #
16
- # Entreprise a au plus une Adresse Postale;
17
- # EntrepriseContact est quand un(e) Entreprise a Personnes comme -contact;
18
- # pour chaque Entreprise au moins un des suivants s'applique:
19
- # que cette Entreprise a certaines Personnes comme -contact,
20
- # que cette Entreprise a certaines Adresses Postales et que ces Adresses Postales ont un Code Postale;
21
- #
@@ -1,86 +0,0 @@
1
- #
2
- # ActiveFacts tests: Test the CQL parser by looking at its parse trees.
3
- # Copyright (c) 2008 Clifford Heath. Read the LICENSE file.
4
- #
5
-
6
- require 'activefacts/cql'
7
- require 'activefacts/support'
8
- require 'activefacts/api/support'
9
- require 'spec_helper'
10
- require 'helpers/test_parser'
11
-
12
- describe "Parsing Invalid Numbers and Strings" do
13
- it "should fail to parse an octal number containing non-octal digits" do
14
- "aa is written as b(08);".
15
- should fail_to_parse /Expected (.|\n)* at .* after aa is written as b\(0$/
16
- end
17
-
18
- it "should fail to parse a hexadecimal number containing non-hexadecimal digits" do
19
- "aa is written as b(0xDice);".
20
- should fail_to_parse /Expected \[0-9A-Fa-f\] at .* after aa is written as b\(0xD$/
21
- end
22
-
23
- it "should fail to parse a negative number with an intervening space" do
24
- "aa is written as b(- 1);".
25
- should fail_to_parse /Expected .* after aa is written as b\(/
26
- end
27
-
28
- it "should fail to parse an explicit positive number with an intervening space" do
29
- "aa is written as b(+ 1);".
30
- should fail_to_parse /Expected .* after aa is written as b\(/
31
- end
32
-
33
- it "should fail to parse a negative octal number" do
34
- "aa is written as b(-077);".
35
- should fail_to_parse /Expected .* after aa is written as b\(/
36
- end
37
-
38
- it "should fail to parse a negative hexadecimal number" do
39
- "aa is written as b(-0xFace);".
40
- should fail_to_parse /Expected .* after aa is written as b\(/
41
- end
42
-
43
- it "should fail to parse invalid real numbers (no digits before or nonzero after the point)" do
44
- "aa is written as b(.0);".
45
- should fail_to_parse /Expected .* after aa is written as b\(/
46
- end
47
-
48
- it "should fail to parse invalid real numbers (no digits after or nonzero before the point)" do
49
- "aa is written as b(0.);".
50
- should fail_to_parse /Expected .* after aa is written as b\(/
51
- end
52
-
53
- it "should fail to parse a number with illegal whitespace before the exponent" do
54
- "inch converts to 1 inch; aa is written as b() inch ^2 ; ".
55
- should fail_to_parse /Expected .* after aa is written as b\(\) inch/
56
- end
57
-
58
- it "should fail to parse a number with illegal whitespace around the exponent" do
59
- "inch converts to 1 inch; aa is written as b() inch^ 2 ; ".
60
- should fail_to_parse /Expected .* after aa is written as b\(\) inch/
61
- end
62
-
63
- it "should fail to parse a string with an illegal octal escape" do
64
- "aa is written as b() restricted to { '\\7a' };".
65
- should fail_to_parse /Expected .* aa is written as b\(\) restricted to \{ '/
66
- end
67
-
68
- it "should fail to parse a string with a control character" do
69
- "aa is written as b() restricted to { '\001' };".
70
- should fail_to_parse /Expected .* aa is written as b\(\) restricted to \{ '/
71
- end
72
-
73
- it "should fail to parse a string with a control character" do
74
- "aa is written as b() restricted to { '\n' };".
75
- should fail_to_parse /Expected .* aa is written as b\(\) restricted to \{ '/
76
- end
77
-
78
- it "should fail to parse a cross-typed range" do
79
- "aa is written as b() restricted to { 0..'A' };".
80
- should fail_to_parse /Expected .* after aa is written as b\(\) restricted to \{ 0\.\./
81
-
82
- "aa is written as b() restricted to { 'a'..27 };".
83
- should fail_to_parse /Expected .* after aa is written as b\(\) restricted to \{ 'a'\.\./
84
- end
85
-
86
- end
@@ -1,19 +0,0 @@
1
- #
2
- # ActiveFacts tests: Test the CQL parser by looking at its parse trees.
3
- # Copyright (c) 2008 Clifford Heath. Read the LICENSE file.
4
- #
5
-
6
- require 'activefacts/cql'
7
- require 'activefacts/support'
8
- require 'activefacts/api/support'
9
- require 'spec_helper'
10
- require 'helpers/test_parser'
11
-
12
- describe "ASTs from Derived Fact Types with expressions" do
13
- it "should parse a simple comparison clause" do
14
- %q{
15
- each combination FamilyName, GivenName occurs at most one time in Competitor has FamilyName, Competitor has GivenName;
16
- }.should parse_to_ast \
17
- "PresenceConstraint over [[{Competitor} \"has\" {FamilyName}], [{Competitor} \"has\" {GivenName}]] -1 over ({FamilyName}, {GivenName})"
18
- end
19
- end