gloo 7.1 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -2
  3. data/docs/application.md +9 -0
  4. data/docs/development.md +22 -2
  5. data/docs/iterators.md +25 -1
  6. data/docs/language_syntax.md +1 -1
  7. data/docs/plugins.md +1 -1
  8. data/docs/verbs.md +2 -1
  9. data/lib/VERSION +1 -1
  10. data/lib/VERSION_NOTES +16 -0
  11. data/lib/gloo/app/args.rb +3 -5
  12. data/lib/gloo/app/log.rb +2 -2
  13. data/lib/gloo/core/invoker.rb +20 -7
  14. data/lib/gloo/core/pn.rb +5 -0
  15. data/lib/gloo/core/verb.rb +14 -3
  16. data/lib/gloo/exec/exec_env.rb +6 -3
  17. data/lib/gloo/exec/script.rb +7 -0
  18. data/lib/gloo/objs/basic/script.rb +9 -0
  19. data/lib/gloo/objs/ctrl/each.rb +5 -3
  20. data/lib/gloo/objs/ctrl/each_child.rb +6 -2
  21. data/lib/gloo/objs/ctrl/each_dir.rb +1 -1
  22. data/lib/gloo/objs/ctrl/each_file.rb +1 -1
  23. data/lib/gloo/objs/ctrl/each_line.rb +4 -3
  24. data/lib/gloo/objs/ctrl/each_word.rb +1 -1
  25. data/lib/gloo/objs/ctrl/repeat.rb +5 -3
  26. data/lib/gloo/objs/str_utils/cipher.rb +10 -2
  27. data/lib/gloo/persist/declaration_ledger.rb +6 -6
  28. data/lib/gloo/persist/disc_mech.rb +38 -20
  29. data/lib/gloo/persist/file_loader.rb +1 -1
  30. data/lib/gloo/persist/persist_man.rb +1 -1
  31. data/lib/gloo/verbs/break.rb +7 -2
  32. data/lib/gloo/verbs/create.rb +4 -2
  33. data/lib/gloo/verbs/eval.rb +5 -4
  34. data/lib/gloo/verbs/invoke.rb +7 -6
  35. data/lib/gloo/verbs/load.rb +7 -1
  36. data/lib/gloo/verbs/log.rb +8 -4
  37. data/lib/gloo/verbs/show.rb +15 -10
  38. data/lib/gloo.rb +18 -4
  39. data/lib/run.rb +3 -9
  40. data/test.gloo/app/embed.test.gloo +31 -0
  41. data/test.gloo/app/fixtures/embed_harness.rb +15 -0
  42. data/test.gloo/ctrl/each.test.gloo +72 -0
  43. data/test.gloo/lang/exceptions.test.gloo +22 -0
  44. data/test.gloo/objs/cipher.test.gloo +27 -0
  45. data/test.gloo/objs/int.test.gloo +6 -3
  46. data/test.gloo/verbs/break.test.gloo +66 -0
  47. data/test.gloo/verbs/create.test.gloo +25 -0
  48. data/test.gloo/verbs/eval.test.gloo +8 -0
  49. data/test.gloo/verbs/invoke.test.gloo +50 -0
  50. data/test.gloo/verbs/load.test.gloo +34 -0
  51. data/test.gloo/verbs/log.test.gloo +16 -0
  52. data/test.gloo/verbs/show.test.gloo +32 -0
  53. metadata +3 -1
@@ -11,6 +11,31 @@ tests.verbs.create [can] :
11
11
  eval it = 'hello'
12
12
  assert "expected it to equal the created value"
13
13
 
14
+ here_box [can] :
15
+
16
+ create_with_a_here_path [test] :
17
+ description [string] : create takes a ^ path inside a script, like other verbs.
18
+ on_test [script] :
19
+ create ^^.here_box.made as string : 'made here'
20
+ eval tests.verbs.create.here_box.made = 'made here'
21
+ assert "expected ^^.here_box.made to be created"
22
+
23
+ create_with_a_one_level_here_path [test] :
24
+ description [string] : create ^.name makes a child of the script's parent (here, the test).
25
+ on_test [script] :
26
+ create ^.child_of_test as int : 3
27
+ eval tests.verbs.create.create_with_a_one_level_here_path.child_of_test = 3
28
+ assert "expected ^.child_of_test under the test"
29
+
30
+ create_with_a_context_path [test] :
31
+ description [string] : create takes an @ path, relative to the context.
32
+ on_test [script] :
33
+ context tests.verbs.create.here_box
34
+ create @.via_context as int : 5
35
+ context root
36
+ eval tests.verbs.create.here_box.via_context = 5
37
+ assert "expected @.via_context to be created in the context"
38
+
14
39
  tests.verbs.create_names [can] :
15
40
 
16
41
  err_fired [bool] : false
@@ -15,3 +15,11 @@ tests.verbs.eval [can] :
15
15
 
16
16
  eval false
17
17
  refute "expected false to be false"
18
+
19
+ failed_expression_puts_false_in_it [test] :
20
+ description [string] : eval of an expression that fails puts false in it.
21
+ expect_errors [bool] : true
22
+ on_test [script] :
23
+ eval 1 + no_such_obj_xyz
24
+ eval it = false
25
+ assert "expected it to be false after a failed expression"
@@ -90,3 +90,53 @@ tests.verbs.invoke [can] :
90
90
  show invoke( tests.verbs.invoke.greet "Bob Smith" )
91
91
  eval it = "Hi, Bob Smith"
92
92
  assert "expected it to be 'Hi, Bob Smith'"
93
+
94
+ wrong_param_count_sets_it_false [test] :
95
+ description [string] : invoke with the wrong number of params puts false in it.
96
+ expect_errors [bool] : true
97
+ on_test [script] :
98
+ eval 'Hi'
99
+ invoke tests.verbs.invoke.add 1
100
+ eval it = false
101
+ assert "expected it to be false after a failed invoke"
102
+
103
+ shortcut_wrong_param_count_sets_it_false [test] :
104
+ description [string] : ~> with the wrong number of params puts false in it.
105
+ expect_errors [bool] : true
106
+ on_test [script] :
107
+ eval 'Hi'
108
+ ~> tests.verbs.invoke.add 1
109
+ eval it = false
110
+ assert "expected it to be false after a failed ~>"
111
+
112
+ not_a_function_sets_it_false [test] :
113
+ description [string] : invoke of something that isn't a function puts false in it.
114
+ expect_errors [bool] : true
115
+ on_test [script] :
116
+ eval 'Hi'
117
+ invoke tests.verbs.invoke.total
118
+ eval it = false
119
+ assert "expected it to be false after invoking a non-function"
120
+
121
+ missing_arg_object_is_an_error [test] :
122
+ description [string] : an argument naming a missing object fires on_error and puts false in it.
123
+ expect_errors [bool] : true
124
+ on_test [script] :
125
+ put false into ^^.err_fired
126
+ eval 'Hi'
127
+ invoke tests.verbs.invoke.add no_such_obj_xyz 4
128
+ eval it = false
129
+ assert "expected it to be false"
130
+ eval ^^.err_fired = true
131
+ assert "expected on_error to fire for the missing argument"
132
+
133
+ inline_failure_in_put_sets_it_false [test] :
134
+ description [string] : a failed invoke( ... ) inside put puts false in it.
135
+ expect_errors [bool] : true
136
+ on_test [script] :
137
+ put 5 into ^^.total
138
+ put invoke( tests.verbs.invoke.add 1 ) into ^^.total
139
+ eval it = false
140
+ assert "expected it to be false"
141
+ eval ^^.total = 5
142
+ assert "expected the target to keep its value"
@@ -13,6 +13,9 @@ tests.verbs.load [can] :
13
13
  # Scratch files live in the gloo tmp folder ($.gloo_tmp).
14
14
  on_load [script] :
15
15
  put $.gloo_tmp '/gloo_load_no_objects_test.gloo' into ^.f
16
+ put $.gloo_tmp ^.wild_name into ^.wild_dir
17
+ put ^.wild_dir '/wild_a.gloo' into ^.wild_a
18
+ put ^.wild_dir '/wild_b.gloo' into ^.wild_b
16
19
 
17
20
  comments_only [text] : BEGIN
18
21
  # This file has comments,
@@ -26,6 +29,10 @@ END
26
29
 
27
30
  computed_name [string] : /gloo_load_computed_test.gloo
28
31
  lib_name [string] : md
32
+ wild_name [string] : /gloo_load_wild_test
33
+ wild_dir [file] :
34
+ wild_a [file] :
35
+ wild_b [file] :
29
36
  computed_f [file] :
30
37
  computed_fixture [text] : BEGIN
31
38
  computed_demo [can] :
@@ -138,3 +145,30 @@ END
138
145
  assert "expected load lib ( expr ) not to fire on_error"
139
146
  exists? object markdown
140
147
  assert "expected the markdown type to be registered"
148
+
149
+ load_an_absolute_wildcard_path [test] :
150
+ description [string] : load {absolute folder}/* loads every .gloo file in the folder.
151
+ on_test [script] :
152
+ tell ^^.wild_dir to mkdir
153
+ tell ^^.wild_a to write ( 'wild_a [can] :' )
154
+ tell ^^.wild_b to write ( 'wild_b [can] :' )
155
+ load ( ^^.wild_dir '/*' )
156
+ exists? wild_a
157
+ assert "expected wild_a.gloo to be loaded"
158
+ exists? wild_b
159
+ assert "expected wild_b.gloo to be loaded"
160
+ tell wild_a to unload
161
+ tell wild_b to unload
162
+ tell ^^.wild_a to delete
163
+ tell ^^.wild_b to delete
164
+
165
+ load_a_full_path_without_the_extension [test] :
166
+ description [string] : load of a full path finds the .gloo file without the extension being given.
167
+ on_test [script] :
168
+ put $.gloo_tmp ^^.computed_name into ^^.computed_f
169
+ tell ^^.computed_f to write ( ^^.computed_fixture )
170
+ load ( $.gloo_tmp '/gloo_load_computed_test' )
171
+ eval computed_demo.s = 'hi'
172
+ assert "expected the full path without .gloo to load"
173
+ tell computed_demo to unload
174
+ tell ^^.computed_f to delete
@@ -10,3 +10,19 @@ tests.verbs.log [can] :
10
10
  log 'debug' (debug)
11
11
  eval it = 'debug'
12
12
  assert "expected it to be 'debug'"
13
+
14
+ failed_expression_puts_false_in_it [test] :
15
+ description [string] : log of an expression that fails puts false in it.
16
+ expect_errors [bool] : true
17
+ on_test [script] :
18
+ log 1 + no_such_obj_xyz
19
+ eval it = false
20
+ assert "expected it to be false after a failed expression"
21
+
22
+ failed_level_puts_the_value_in_it [test] :
23
+ description [string] : log with a level that fails still puts the value in it.
24
+ expect_errors [bool] : true
25
+ on_test [script] :
26
+ log 'plain' (no_such_obj_xyz)
27
+ eval it = 'plain'
28
+ assert "expected the value in it when only the level fails"
@@ -33,3 +33,35 @@ tests.verbs.show [can] :
33
33
  show 'a' + 'b'
34
34
  eval it = 'ab'
35
35
  assert "expected it to be 'ab'"
36
+
37
+ add [ƒ] :
38
+ on_invoke [script] :
39
+ put ^.params.x + ^.params.y into ^.result
40
+ params [can] :
41
+ x [int] :
42
+ y [int] :
43
+ result [int] :
44
+
45
+ failed_expression_puts_false_in_it [test] :
46
+ description [string] : show of an expression that fails puts false in it.
47
+ expect_errors [bool] : true
48
+ on_test [script] :
49
+ show 1 + no_such_obj_xyz
50
+ eval it = false
51
+ assert "expected it to be false after a failed expression"
52
+
53
+ failed_inline_invoke_puts_false_in_it [test] :
54
+ description [string] : show of an inline invoke that fails puts false in it.
55
+ expect_errors [bool] : true
56
+ on_test [script] :
57
+ show invoke( tests.verbs.show.add 1 )
58
+ eval it = false
59
+ assert "expected it to be false after a failed inline invoke"
60
+
61
+ failed_color_puts_the_value_in_it [test] :
62
+ description [string] : show with a color that fails still puts the value in it.
63
+ expect_errors [bool] : true
64
+ on_test [script] :
65
+ show 'plain' (no_such_obj_xyz)
66
+ eval it = 'plain'
67
+ assert "expected the value in it when only the color fails"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo
3
3
  version: !ruby/object:Gem::Version
4
- version: '7.1'
4
+ version: 7.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
@@ -442,6 +442,8 @@ files:
442
442
  - lib/gloo/verbs/version.rb
443
443
  - lib/gloo/verbs/wait.rb
444
444
  - lib/run.rb
445
+ - test.gloo/app/embed.test.gloo
446
+ - test.gloo/app/fixtures/embed_harness.rb
445
447
  - test.gloo/basic.test.gloo
446
448
  - test.gloo/ctrl/each.test.gloo
447
449
  - test.gloo/dt/date.test.gloo