finitio 0.7.0.pre.rc3 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +34 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +41 -41
  5. data/README.md +88 -12
  6. data/lib/finitio.rb +37 -5
  7. data/lib/finitio/generation.rb +106 -0
  8. data/lib/finitio/generation/ad_type.rb +10 -0
  9. data/lib/finitio/generation/alias_type.rb +9 -0
  10. data/lib/finitio/generation/any_type.rb +11 -0
  11. data/lib/finitio/generation/builtin_type.rb +9 -0
  12. data/lib/finitio/generation/hash_based_type.rb +15 -0
  13. data/lib/finitio/generation/heuristic.rb +8 -0
  14. data/lib/finitio/generation/heuristic/constant.rb +30 -0
  15. data/lib/finitio/generation/heuristic/random.rb +52 -0
  16. data/lib/finitio/generation/rel_based_type.rb +13 -0
  17. data/lib/finitio/generation/seq_type.rb +13 -0
  18. data/lib/finitio/generation/set_type.rb +13 -0
  19. data/lib/finitio/generation/sub_type.rb +9 -0
  20. data/lib/finitio/generation/union_type.rb +10 -0
  21. data/lib/finitio/inference.rb +51 -0
  22. data/lib/finitio/json_schema.rb +16 -0
  23. data/lib/finitio/json_schema/ad_type.rb +11 -0
  24. data/lib/finitio/json_schema/alias_type.rb +9 -0
  25. data/lib/finitio/json_schema/any_type.rb +9 -0
  26. data/lib/finitio/json_schema/builtin_type.rb +27 -0
  27. data/lib/finitio/json_schema/hash_based_type.rb +25 -0
  28. data/lib/finitio/json_schema/rel_based_type.rb +13 -0
  29. data/lib/finitio/json_schema/seq_type.rb +12 -0
  30. data/lib/finitio/json_schema/set_type.rb +13 -0
  31. data/lib/finitio/json_schema/struct_type.rb +12 -0
  32. data/lib/finitio/json_schema/sub_type.rb +10 -0
  33. data/lib/finitio/json_schema/union_type.rb +11 -0
  34. data/lib/finitio/support.rb +18 -0
  35. data/lib/finitio/support/attribute.rb +8 -0
  36. data/lib/finitio/support/compilation.rb +18 -18
  37. data/lib/finitio/support/contract.rb +10 -2
  38. data/lib/finitio/support/fetch_scope.rb +19 -0
  39. data/lib/finitio/support/heading.rb +42 -1
  40. data/lib/finitio/syntax.rb +1 -1
  41. data/lib/finitio/syntax/import.rb +1 -1
  42. data/lib/finitio/syntax/lexer.citrus +1 -1
  43. data/lib/finitio/syntax/type.rb +2 -0
  44. data/lib/finitio/syntax/type/high_order_type_instantiation.rb +29 -0
  45. data/lib/finitio/syntax/type/high_order_vars.rb +16 -0
  46. data/lib/finitio/syntax/type/type_def.rb +11 -1
  47. data/lib/finitio/syntax/types.citrus +14 -1
  48. data/lib/finitio/system.rb +20 -4
  49. data/lib/finitio/type.rb +19 -0
  50. data/lib/finitio/type/ad_type.rb +9 -1
  51. data/lib/finitio/type/alias_type.rb +8 -0
  52. data/lib/finitio/type/any_type.rb +12 -0
  53. data/lib/finitio/type/builtin_type.rb +4 -0
  54. data/lib/finitio/type/collection_type.rb +15 -0
  55. data/lib/finitio/type/heading_based_type.rb +17 -0
  56. data/lib/finitio/type/high_order_type.rb +39 -0
  57. data/lib/finitio/type/multi_relation_type.rb +4 -0
  58. data/lib/finitio/type/multi_tuple_type.rb +4 -0
  59. data/lib/finitio/type/proxy_type.rb +10 -20
  60. data/lib/finitio/type/relation_type.rb +4 -0
  61. data/lib/finitio/type/seq_type.rb +1 -1
  62. data/lib/finitio/type/struct_type.rb +8 -0
  63. data/lib/finitio/type/sub_type.rb +8 -0
  64. data/lib/finitio/type/tuple_type.rb +4 -0
  65. data/lib/finitio/type/union_type.rb +19 -0
  66. data/lib/finitio/version.rb +2 -2
  67. data/spec/finitio/test_stdlib_memoization.rb +22 -0
  68. data/spec/finitio/test_system.rb +0 -11
  69. data/spec/generation/test_generation.rb +169 -0
  70. data/spec/heading/test_looks_similar.rb +45 -0
  71. data/spec/heading/test_suppremum.rb +56 -0
  72. data/spec/inference/test_inference.rb +42 -0
  73. data/spec/json_schema/test_ad_type.rb +20 -0
  74. data/spec/json_schema/test_alias_type.rb +15 -0
  75. data/spec/json_schema/test_any_type.rb +11 -0
  76. data/spec/json_schema/test_builtin_type.rb +51 -0
  77. data/spec/json_schema/test_multi_relation_type.rb +58 -0
  78. data/spec/json_schema/test_multi_tuple_type.rb +50 -0
  79. data/spec/json_schema/test_relation_type.rb +30 -0
  80. data/spec/json_schema/test_seq_type.rb +18 -0
  81. data/spec/json_schema/test_set_type.rb +19 -0
  82. data/spec/json_schema/test_struct_type.rb +18 -0
  83. data/spec/json_schema/test_sub_type.rb +17 -0
  84. data/spec/json_schema/test_tuple_type.rb +26 -0
  85. data/spec/json_schema/test_union_type.rb +17 -0
  86. data/spec/regression/test_heading_extra_are_proxy_resolved.rb +41 -0
  87. data/spec/spec_helper.rb +32 -6
  88. data/spec/support/test_compare_attrs.rb +67 -0
  89. data/spec/syntax/test_compile.rb +57 -0
  90. data/spec/system/fixtures/system.fio +2 -0
  91. data/spec/{finitio → system/fixtures}/with-duplicates.fio +2 -1
  92. data/spec/system/test_check_and_warn.rb +55 -0
  93. data/spec/type/ad_type/test_initialize.rb +1 -8
  94. data/spec/type/relation_type/test_suppremum.rb +104 -0
  95. data/spec/type/seq_type/test_suppremum.rb +54 -0
  96. data/spec/type/set_type/test_suppremum.rb +54 -0
  97. data/spec/type/test_suppremum.rb +49 -0
  98. data/spec/type/test_unconstrained.rb +150 -0
  99. data/spec/type/tuple_type/test_suppremum.rb +119 -0
  100. data/spec/type/union_type/test_suppremum.rb +51 -0
  101. data/tasks/test.rake +1 -1
  102. metadata +99 -15
  103. data/spec/type/proxy_type/test_delegation.rb +0 -37
  104. data/spec/type/proxy_type/test_resolve.rb +0 -29
@@ -18,7 +18,7 @@ namespace :test do
18
18
  require 'cucumber/rake/task'
19
19
 
20
20
  Cucumber::Rake::Task.new(:cucumber) do |t|
21
- t.cucumber_opts = "features --format pretty"
21
+ t.cucumber_opts = "features --format progress"
22
22
  end
23
23
  rescue LoadError => ex
24
24
  task :unit do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finitio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.pre.rc3
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-27 00:00:00.000000000 Z
11
+ date: 2020-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: citrus
@@ -50,6 +50,33 @@ files:
50
50
  - finitio.gemspec
51
51
  - lib/finitio.rb
52
52
  - lib/finitio/errors.rb
53
+ - lib/finitio/generation.rb
54
+ - lib/finitio/generation/ad_type.rb
55
+ - lib/finitio/generation/alias_type.rb
56
+ - lib/finitio/generation/any_type.rb
57
+ - lib/finitio/generation/builtin_type.rb
58
+ - lib/finitio/generation/hash_based_type.rb
59
+ - lib/finitio/generation/heuristic.rb
60
+ - lib/finitio/generation/heuristic/constant.rb
61
+ - lib/finitio/generation/heuristic/random.rb
62
+ - lib/finitio/generation/rel_based_type.rb
63
+ - lib/finitio/generation/seq_type.rb
64
+ - lib/finitio/generation/set_type.rb
65
+ - lib/finitio/generation/sub_type.rb
66
+ - lib/finitio/generation/union_type.rb
67
+ - lib/finitio/inference.rb
68
+ - lib/finitio/json_schema.rb
69
+ - lib/finitio/json_schema/ad_type.rb
70
+ - lib/finitio/json_schema/alias_type.rb
71
+ - lib/finitio/json_schema/any_type.rb
72
+ - lib/finitio/json_schema/builtin_type.rb
73
+ - lib/finitio/json_schema/hash_based_type.rb
74
+ - lib/finitio/json_schema/rel_based_type.rb
75
+ - lib/finitio/json_schema/seq_type.rb
76
+ - lib/finitio/json_schema/set_type.rb
77
+ - lib/finitio/json_schema/struct_type.rb
78
+ - lib/finitio/json_schema/sub_type.rb
79
+ - lib/finitio/json_schema/union_type.rb
53
80
  - lib/finitio/stdlib/finitio/data.fio
54
81
  - lib/finitio/support.rb
55
82
  - lib/finitio/support/attribute.rb
@@ -57,6 +84,7 @@ files:
57
84
  - lib/finitio/support/constraint.rb
58
85
  - lib/finitio/support/contract.rb
59
86
  - lib/finitio/support/dress_helper.rb
87
+ - lib/finitio/support/fetch_scope.rb
60
88
  - lib/finitio/support/heading.rb
61
89
  - lib/finitio/support/metadata.rb
62
90
  - lib/finitio/support/proc_with_code.rb
@@ -100,6 +128,8 @@ files:
100
128
  - lib/finitio/syntax/type/external_pair.rb
101
129
  - lib/finitio/syntax/type/heading.rb
102
130
  - lib/finitio/syntax/type/heading_extra.rb
131
+ - lib/finitio/syntax/type/high_order_type_instantiation.rb
132
+ - lib/finitio/syntax/type/high_order_vars.rb
103
133
  - lib/finitio/syntax/type/inline_pair.rb
104
134
  - lib/finitio/syntax/type/lambda_expr.rb
105
135
  - lib/finitio/syntax/type/main_type.rb
@@ -126,6 +156,7 @@ files:
126
156
  - lib/finitio/type/collection_type.rb
127
157
  - lib/finitio/type/hash_based_type.rb
128
158
  - lib/finitio/type/heading_based_type.rb
159
+ - lib/finitio/type/high_order_type.rb
129
160
  - lib/finitio/type/multi_relation_type.rb
130
161
  - lib/finitio/type/multi_tuple_type.rb
131
162
  - lib/finitio/type/proxy_type.rb
@@ -152,18 +183,37 @@ files:
152
183
  - spec/finitio/system.fio
153
184
  - spec/finitio/test_ast.rb
154
185
  - spec/finitio/test_parse.rb
186
+ - spec/finitio/test_stdlib_memoization.rb
155
187
  - spec/finitio/test_system.rb
156
- - spec/finitio/with-duplicates.fio
188
+ - spec/generation/test_generation.rb
157
189
  - spec/heading/test_allow_extra.rb
158
190
  - spec/heading/test_each.rb
159
191
  - spec/heading/test_equality.rb
160
192
  - spec/heading/test_hash.rb
161
193
  - spec/heading/test_hash_get.rb
162
194
  - spec/heading/test_initialize.rb
195
+ - spec/heading/test_looks_similar.rb
163
196
  - spec/heading/test_multi.rb
164
197
  - spec/heading/test_size.rb
198
+ - spec/heading/test_suppremum.rb
165
199
  - spec/heading/test_to_name.rb
200
+ - spec/inference/test_inference.rb
201
+ - spec/json_schema/test_ad_type.rb
202
+ - spec/json_schema/test_alias_type.rb
203
+ - spec/json_schema/test_any_type.rb
204
+ - spec/json_schema/test_builtin_type.rb
205
+ - spec/json_schema/test_multi_relation_type.rb
206
+ - spec/json_schema/test_multi_tuple_type.rb
207
+ - spec/json_schema/test_relation_type.rb
208
+ - spec/json_schema/test_seq_type.rb
209
+ - spec/json_schema/test_set_type.rb
210
+ - spec/json_schema/test_struct_type.rb
211
+ - spec/json_schema/test_sub_type.rb
212
+ - spec/json_schema/test_tuple_type.rb
213
+ - spec/json_schema/test_union_type.rb
214
+ - spec/regression/test_heading_extra_are_proxy_resolved.rb
166
215
  - spec/spec_helper.rb
216
+ - spec/support/test_compare_attrs.rb
167
217
  - spec/support/test_proc_with_code.rb
168
218
  - spec/syntax/expr/test_free_variables.rb
169
219
  - spec/syntax/expr/test_to_proc_source.rb
@@ -195,7 +245,10 @@ files:
195
245
  - spec/syntax/nodes/test_unnamed_constraint.rb
196
246
  - spec/syntax/test_compile.rb
197
247
  - spec/syntax/test_compile_type.rb
248
+ - spec/system/fixtures/system.fio
249
+ - spec/system/fixtures/with-duplicates.fio
198
250
  - spec/system/test_add_type.rb
251
+ - spec/system/test_check_and_warn.rb
199
252
  - spec/system/test_dsl.rb
200
253
  - spec/system/test_dup.rb
201
254
  - spec/system/test_fetch.rb
@@ -234,26 +287,27 @@ files:
234
287
  - spec/type/multi_tuple_type/test_include.rb
235
288
  - spec/type/multi_tuple_type/test_initialize.rb
236
289
  - spec/type/multi_tuple_type/test_name.rb
237
- - spec/type/proxy_type/test_delegation.rb
238
- - spec/type/proxy_type/test_resolve.rb
239
290
  - spec/type/relation_type/test_default_name.rb
240
291
  - spec/type/relation_type/test_dress.rb
241
292
  - spec/type/relation_type/test_equality.rb
242
293
  - spec/type/relation_type/test_include.rb
243
294
  - spec/type/relation_type/test_initialize.rb
244
295
  - spec/type/relation_type/test_name.rb
296
+ - spec/type/relation_type/test_suppremum.rb
245
297
  - spec/type/seq_type/test_default_name.rb
246
298
  - spec/type/seq_type/test_dress.rb
247
299
  - spec/type/seq_type/test_equality.rb
248
300
  - spec/type/seq_type/test_include.rb
249
301
  - spec/type/seq_type/test_initialize.rb
250
302
  - spec/type/seq_type/test_name.rb
303
+ - spec/type/seq_type/test_suppremum.rb
251
304
  - spec/type/set_type/test_default_name.rb
252
305
  - spec/type/set_type/test_dress.rb
253
306
  - spec/type/set_type/test_equality.rb
254
307
  - spec/type/set_type/test_include.rb
255
308
  - spec/type/set_type/test_initialize.rb
256
309
  - spec/type/set_type/test_name.rb
310
+ - spec/type/set_type/test_suppremum.rb
257
311
  - spec/type/struct_type/test_default_name.rb
258
312
  - spec/type/struct_type/test_dress.rb
259
313
  - spec/type/struct_type/test_equality.rb
@@ -266,18 +320,22 @@ files:
266
320
  - spec/type/sub_type/test_include.rb
267
321
  - spec/type/sub_type/test_initialize.rb
268
322
  - spec/type/sub_type/test_name.rb
323
+ - spec/type/test_suppremum.rb
324
+ - spec/type/test_unconstrained.rb
269
325
  - spec/type/tuple_type/test_default_name.rb
270
326
  - spec/type/tuple_type/test_dress.rb
271
327
  - spec/type/tuple_type/test_equality.rb
272
328
  - spec/type/tuple_type/test_include.rb
273
329
  - spec/type/tuple_type/test_initialize.rb
274
330
  - spec/type/tuple_type/test_name.rb
331
+ - spec/type/tuple_type/test_suppremum.rb
275
332
  - spec/type/union_type/test_default_name.rb
276
333
  - spec/type/union_type/test_dress.rb
277
334
  - spec/type/union_type/test_equality.rb
278
335
  - spec/type/union_type/test_include.rb
279
336
  - spec/type/union_type/test_initialize.rb
280
337
  - spec/type/union_type/test_name.rb
338
+ - spec/type/union_type/test_suppremum.rb
281
339
  - spec/type_factory/dsl/test_adt.rb
282
340
  - spec/type_factory/dsl/test_any.rb
283
341
  - spec/type_factory/dsl/test_attribute.rb
@@ -303,7 +361,7 @@ files:
303
361
  homepage: https://github.com/blambeau/finitio
304
362
  licenses: []
305
363
  metadata: {}
306
- post_install_message:
364
+ post_install_message:
307
365
  rdoc_options: []
308
366
  require_paths:
309
367
  - lib
@@ -314,13 +372,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
372
  version: '0'
315
373
  required_rubygems_version: !ruby/object:Gem::Requirement
316
374
  requirements:
317
- - - ">"
375
+ - - ">="
318
376
  - !ruby/object:Gem::Version
319
- version: 1.3.1
377
+ version: '0'
320
378
  requirements: []
321
- rubyforge_project:
322
- rubygems_version: 2.5.2
323
- signing_key:
379
+ rubygems_version: 3.1.4
380
+ signing_key:
324
381
  specification_version: 4
325
382
  summary: Finitio - in Ruby
326
383
  test_files:
@@ -351,27 +408,45 @@ test_files:
351
408
  - spec/attribute/test_fetch_on.rb
352
409
  - spec/attribute/test_optional.rb
353
410
  - spec/attribute/test_required.rb
411
+ - spec/json_schema/test_tuple_type.rb
412
+ - spec/json_schema/test_set_type.rb
413
+ - spec/json_schema/test_union_type.rb
414
+ - spec/json_schema/test_multi_relation_type.rb
415
+ - spec/json_schema/test_builtin_type.rb
416
+ - spec/json_schema/test_alias_type.rb
417
+ - spec/json_schema/test_multi_tuple_type.rb
418
+ - spec/json_schema/test_struct_type.rb
419
+ - spec/json_schema/test_sub_type.rb
420
+ - spec/json_schema/test_any_type.rb
421
+ - spec/json_schema/test_ad_type.rb
422
+ - spec/json_schema/test_relation_type.rb
423
+ - spec/json_schema/test_seq_type.rb
354
424
  - spec/heading/test_hash_get.rb
355
425
  - spec/heading/test_initialize.rb
356
426
  - spec/heading/test_equality.rb
357
427
  - spec/heading/test_to_name.rb
358
428
  - spec/heading/test_multi.rb
359
429
  - spec/heading/test_hash.rb
430
+ - spec/heading/test_suppremum.rb
360
431
  - spec/heading/test_allow_extra.rb
361
432
  - spec/heading/test_size.rb
433
+ - spec/heading/test_looks_similar.rb
362
434
  - spec/heading/test_each.rb
363
435
  - spec/test_finitio.rb
364
436
  - spec/finitio/test_ast.rb
365
- - spec/finitio/with-duplicates.fio
366
437
  - spec/finitio/system.fio
367
438
  - spec/finitio/test_system.rb
368
439
  - spec/finitio/test_parse.rb
440
+ - spec/finitio/test_stdlib_memoization.rb
369
441
  - spec/system/test_initialize.rb
370
442
  - spec/system/test_get_type.rb
371
443
  - spec/system/test_fetch.rb
372
444
  - spec/system/test_dup.rb
373
445
  - spec/system/test_add_type.rb
374
446
  - spec/system/test_dsl.rb
447
+ - spec/system/fixtures/with-duplicates.fio
448
+ - spec/system/fixtures/system.fio
449
+ - spec/system/test_check_and_warn.rb
375
450
  - spec/type/multi_relation_type/test_name.rb
376
451
  - spec/type/multi_relation_type/test_initialize.rb
377
452
  - spec/type/multi_relation_type/test_equality.rb
@@ -384,8 +459,8 @@ test_files:
384
459
  - spec/type/sub_type/test_include.rb
385
460
  - spec/type/sub_type/test_default_name.rb
386
461
  - spec/type/sub_type/test_dress.rb
387
- - spec/type/proxy_type/test_resolve.rb
388
- - spec/type/proxy_type/test_delegation.rb
462
+ - spec/type/test_unconstrained.rb
463
+ - spec/type/test_suppremum.rb
389
464
  - spec/type/ad_type/test_name.rb
390
465
  - spec/type/ad_type/test_initialize.rb
391
466
  - spec/type/ad_type/test_include.rb
@@ -400,12 +475,14 @@ test_files:
400
475
  - spec/type/set_type/test_name.rb
401
476
  - spec/type/set_type/test_initialize.rb
402
477
  - spec/type/set_type/test_equality.rb
478
+ - spec/type/set_type/test_suppremum.rb
403
479
  - spec/type/set_type/test_include.rb
404
480
  - spec/type/set_type/test_default_name.rb
405
481
  - spec/type/set_type/test_dress.rb
406
482
  - spec/type/relation_type/test_name.rb
407
483
  - spec/type/relation_type/test_initialize.rb
408
484
  - spec/type/relation_type/test_equality.rb
485
+ - spec/type/relation_type/test_suppremum.rb
409
486
  - spec/type/relation_type/test_include.rb
410
487
  - spec/type/relation_type/test_default_name.rb
411
488
  - spec/type/relation_type/test_dress.rb
@@ -424,12 +501,14 @@ test_files:
424
501
  - spec/type/union_type/test_name.rb
425
502
  - spec/type/union_type/test_initialize.rb
426
503
  - spec/type/union_type/test_equality.rb
504
+ - spec/type/union_type/test_suppremum.rb
427
505
  - spec/type/union_type/test_include.rb
428
506
  - spec/type/union_type/test_default_name.rb
429
507
  - spec/type/union_type/test_dress.rb
430
508
  - spec/type/tuple_type/test_name.rb
431
509
  - spec/type/tuple_type/test_initialize.rb
432
510
  - spec/type/tuple_type/test_equality.rb
511
+ - spec/type/tuple_type/test_suppremum.rb
433
512
  - spec/type/tuple_type/test_include.rb
434
513
  - spec/type/tuple_type/test_default_name.rb
435
514
  - spec/type/tuple_type/test_dress.rb
@@ -439,6 +518,7 @@ test_files:
439
518
  - spec/type/seq_type/test_name.rb
440
519
  - spec/type/seq_type/test_initialize.rb
441
520
  - spec/type/seq_type/test_equality.rb
521
+ - spec/type/seq_type/test_suppremum.rb
442
522
  - spec/type/seq_type/test_include.rb
443
523
  - spec/type/seq_type/test_default_name.rb
444
524
  - spec/type/seq_type/test_dress.rb
@@ -448,7 +528,10 @@ test_files:
448
528
  - spec/type/multi_tuple_type/test_include.rb
449
529
  - spec/type/multi_tuple_type/test_default_name.rb
450
530
  - spec/type/multi_tuple_type/test_dress.rb
531
+ - spec/support/test_compare_attrs.rb
451
532
  - spec/support/test_proc_with_code.rb
533
+ - spec/inference/test_inference.rb
534
+ - spec/regression/test_heading_extra_are_proxy_resolved.rb
452
535
  - spec/syntax/nodes/test_tuple_type.rb
453
536
  - spec/syntax/nodes/test_set_type.rb
454
537
  - spec/syntax/nodes/test_union_type.rb
@@ -479,6 +562,7 @@ test_files:
479
562
  - spec/syntax/expr/test_free_variables.rb
480
563
  - spec/syntax/test_compile.rb
481
564
  - spec/syntax/test_compile_type.rb
565
+ - spec/generation/test_generation.rb
482
566
  - spec/constraint/test_name.rb
483
567
  - spec/constraint/test_equality.rb
484
568
  - spec/constraint/test_anonymous.rb
@@ -1,37 +0,0 @@
1
- require 'spec_helper'
2
- module Finitio
3
- describe ProxyType, "delegation pattern" do
4
-
5
- let(:proxy){ ProxyType.new('Int', intType) }
6
-
7
- it 'should delegate name' do
8
- expect(proxy.name).to eq(intType.name)
9
- end
10
-
11
- it 'should delegate default_name' do
12
- expect(proxy.default_name).to eq(intType.default_name)
13
- end
14
-
15
- it 'should delegate hash' do
16
- expect(proxy.hash).to eq(intType.hash)
17
- end
18
-
19
- it 'should delegate ==' do
20
- expect(intType == proxy).to eq(true)
21
- expect(proxy == intType).to eq(true)
22
- end
23
-
24
- it 'should delegate dress' do
25
- expect(proxy.dress(12)).to eq(12)
26
- end
27
-
28
- it 'should delegate include?' do
29
- expect(proxy.include?(12)).to eq(true)
30
- end
31
-
32
- it 'should delegate to_s' do
33
- expect(proxy.to_s).to eq(intType.to_s)
34
- end
35
-
36
- end
37
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- module Finitio
3
- describe ProxyType, "delegation pattern" do
4
-
5
- let(:proxy){ ProxyType.new('Int') }
6
-
7
- subject{ proxy.resolve(system) }
8
-
9
- context 'when type exists' do
10
- let(:system){ {'Int' => intType} }
11
-
12
- it 'resolves fine' do
13
- subject
14
- expect(proxy.target).to eq(intType)
15
- end
16
- end
17
-
18
- context 'when type does not exist' do
19
- let(:system){ {} }
20
-
21
- it 'raises an error' do
22
- expect{
23
- subject
24
- }.to raise_error(Finitio::Error, "No such type `Int`")
25
- end
26
- end
27
-
28
- end
29
- end