gloo 7.2 → 7.3
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.
- checksums.yaml +4 -4
- data/docs/application.md +19 -3
- data/docs/iterators.md +66 -1
- data/docs/language_objects.md +14 -7
- data/docs/language_scripting.md +17 -0
- data/docs/language_syntax.md +86 -3
- data/docs/objects.md +6 -6
- data/docs/operators.md +36 -2
- data/docs/plugins.md +26 -0
- data/docs/testing.md +31 -2
- data/docs/verbs.md +8 -0
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +15 -0
- data/lib/gloo/app/engine.rb +133 -17
- data/lib/gloo/app/prompt.rb +8 -0
- data/lib/gloo/convert/string_to_decimal.rb +3 -6
- data/lib/gloo/convert/string_to_integer.rb +3 -2
- data/lib/gloo/core/dictionary.rb +23 -12
- data/lib/gloo/core/obj.rb +77 -0
- data/lib/gloo/core/op.rb +99 -0
- data/lib/gloo/core/parser.rb +15 -0
- data/lib/gloo/core/tokens.rb +18 -0
- data/lib/gloo/core/verb.rb +130 -1
- data/lib/gloo/exec/dispatch.rb +7 -3
- data/lib/gloo/exec/runaway_recursion.rb +34 -0
- data/lib/gloo/exec/runner.rb +46 -0
- data/lib/gloo/exec/script.rb +16 -2
- data/lib/gloo/expr/expression.rb +77 -6
- data/lib/gloo/expr/l_decimal.rb +18 -2
- data/lib/gloo/expr/l_integer.rb +5 -2
- data/lib/gloo/expr/op_div.rb +4 -0
- data/lib/gloo/expr/op_eq.rb +4 -0
- data/lib/gloo/expr/op_gt.rb +4 -0
- data/lib/gloo/expr/op_gteq.rb +4 -0
- data/lib/gloo/expr/op_ineq.rb +4 -0
- data/lib/gloo/expr/op_lt.rb +4 -0
- data/lib/gloo/expr/op_lteq.rb +4 -0
- data/lib/gloo/expr/op_minus.rb +4 -0
- data/lib/gloo/expr/op_mult.rb +3 -7
- data/lib/gloo/expr/op_plus.rb +8 -1
- data/lib/gloo/objs/basic/alias.rb +6 -1
- data/lib/gloo/objs/basic/boolean.rb +15 -6
- data/lib/gloo/objs/basic/decimal.rb +25 -3
- data/lib/gloo/objs/basic/script.rb +3 -1
- data/lib/gloo/objs/basic/string_msgs.rb +50 -68
- data/lib/gloo/objs/ctrl/until.rb +219 -0
- data/lib/gloo/plugin/callback.rb +54 -10
- data/lib/gloo/plugin/ext_manager.rb +44 -0
- data/lib/gloo/plugin/lib_manager.rb +65 -1
- data/lib/gloo/shell/runner.rb +36 -9
- data/lib/gloo/verbs/break.rb +6 -4
- data/lib/gloo/verbs/check.rb +8 -2
- data/lib/gloo/verbs/create.rb +13 -4
- data/lib/gloo/verbs/if.rb +33 -10
- data/lib/gloo/verbs/invoke.rb +6 -1
- data/lib/gloo/verbs/list.rb +9 -2
- data/lib/gloo/verbs/load.rb +4 -1
- data/lib/gloo/verbs/move.rb +8 -2
- data/lib/gloo/verbs/put.rb +9 -2
- data/lib/gloo/verbs/reload.rb +2 -1
- data/lib/gloo/verbs/run.rb +8 -1
- data/lib/gloo/verbs/save.rb +4 -0
- data/lib/gloo/verbs/tell.rb +9 -2
- data/lib/gloo/verbs/unless.rb +34 -10
- data/lib/gloo/verbs/unload.rb +81 -16
- data/test.gloo/ctrl/until.test.gloo +100 -0
- data/test.gloo/lang/computed_paths.test.gloo +98 -0
- data/test.gloo/lang/literal.test.gloo +43 -0
- data/test.gloo/lang/ops.test.gloo +193 -0
- data/test.gloo/lang/runaway_recursion.test.gloo +44 -0
- data/test.gloo/objs/decimal.test.gloo +23 -0
- data/test.gloo/objs/string.test.gloo +30 -0
- data/test.gloo/verbs/create.test.gloo +6 -21
- data/test.gloo/verbs/if.test.gloo +41 -0
- data/test.gloo/verbs/load.test.gloo +4 -3
- data/test.gloo/verbs/unless.test.gloo +40 -0
- data/test.gloo/verbs/unload.test.gloo +61 -3
- metadata +6 -1
|
@@ -38,32 +38,17 @@ tests.verbs.create [can] :
|
|
|
38
38
|
|
|
39
39
|
tests.verbs.create_names [can] :
|
|
40
40
|
|
|
41
|
-
err_fired [bool] : false
|
|
42
41
|
list [can] :
|
|
43
42
|
n [int] : 3
|
|
44
|
-
before [int] : 0
|
|
45
43
|
slot [alias] :
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
parenthesised_name_is_an_error [test] :
|
|
51
|
-
description [string] : create doesn't compute a name; a parenthesised one is reported and nothing is created.
|
|
52
|
-
expect_errors [bool] : true
|
|
45
|
+
parenthesised_name_computes_the_name [test] :
|
|
46
|
+
description [string] : create ( expr ) creates the object at the path the expression works out to.
|
|
53
47
|
on_test [script] :
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
eval it = false
|
|
59
|
-
assert "expected it to be false"
|
|
60
|
-
|
|
61
|
-
eval ^^.err_fired = true
|
|
62
|
-
assert "expected a parenthesised name to be an error"
|
|
63
|
-
|
|
64
|
-
tell ^^.list to count
|
|
65
|
-
eval it = ^^.before
|
|
66
|
-
assert "expected nothing to be created"
|
|
48
|
+
create ( 'tests.verbs.create_names.list.p' ^^.n ) as string : made
|
|
49
|
+
eval tests.verbs.create_names.list.p3 = 'made'
|
|
50
|
+
assert "expected the object to be created at the computed path"
|
|
51
|
+
tell tests.verbs.create_names.list.p3 to unload
|
|
67
52
|
|
|
68
53
|
alias_computes_the_name [test] :
|
|
69
54
|
description [string] : The way to create at a computed path: point an alias at it, then create the alias.
|
|
@@ -33,3 +33,44 @@ tests.verbs.if [can] :
|
|
|
33
33
|
eval false
|
|
34
34
|
if false do eval false else eval true
|
|
35
35
|
assert "expected else to run after a 'do' action"
|
|
36
|
+
|
|
37
|
+
#
|
|
38
|
+
# Conditions use the [bool] rule for what counts as true.
|
|
39
|
+
#
|
|
40
|
+
s [string] :
|
|
41
|
+
ran [string] :
|
|
42
|
+
|
|
43
|
+
the_text_true_is_true [test] :
|
|
44
|
+
description [string] : The text 'true' in a condition counts as true.
|
|
45
|
+
on_test [script] :
|
|
46
|
+
put 'true' into ^^.s
|
|
47
|
+
put '' into ^^.ran
|
|
48
|
+
if ^^.s then put 'then' into ^^.ran
|
|
49
|
+
eval ^^.ran = 'then'
|
|
50
|
+
assert "expected the text true to run then"
|
|
51
|
+
|
|
52
|
+
blank_is_false [test] :
|
|
53
|
+
description [string] : A blank value is false, so else runs.
|
|
54
|
+
on_test [script] :
|
|
55
|
+
put '' into ^^.s
|
|
56
|
+
if ^^.s then put 'then' into ^^.ran else put 'else' into ^^.ran
|
|
57
|
+
eval ^^.ran = 'else'
|
|
58
|
+
assert "expected blank to run else"
|
|
59
|
+
|
|
60
|
+
other_text_is_false [test] :
|
|
61
|
+
description [string] : Text that is neither true nor false is false, with a warning.
|
|
62
|
+
expect_errors [bool] : true
|
|
63
|
+
on_test [script] :
|
|
64
|
+
put 'abc' into ^^.s
|
|
65
|
+
if ^^.s then put 'then' into ^^.ran else put 'else' into ^^.ran
|
|
66
|
+
eval ^^.ran = 'else'
|
|
67
|
+
assert "expected other text to run else"
|
|
68
|
+
|
|
69
|
+
failed_condition_runs_neither [test] :
|
|
70
|
+
description [string] : A condition that reports an error abandons the line; else doesn't run.
|
|
71
|
+
expect_errors [bool] : true
|
|
72
|
+
on_test [script] :
|
|
73
|
+
put '' into ^^.ran
|
|
74
|
+
if no.such.obj then put 'then' into ^^.ran else put 'else' into ^^.ran
|
|
75
|
+
eval ^^.ran = ''
|
|
76
|
+
assert "expected neither branch to run"
|
|
@@ -46,9 +46,10 @@ END
|
|
|
46
46
|
load_lib_registers_type [test] :
|
|
47
47
|
description [string] : load lib registers that library's object types.
|
|
48
48
|
on_test [script] :
|
|
49
|
-
#
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
# Start without md, whatever an earlier test or file loaded.
|
|
50
|
+
unload lib md
|
|
51
|
+
exists? object markdown
|
|
52
|
+
refute "markdown type should not be registered after unload"
|
|
52
53
|
|
|
53
54
|
load lib md
|
|
54
55
|
exists? object markdown
|
|
@@ -39,3 +39,43 @@ tests.verbs.unless [can] :
|
|
|
39
39
|
eval false
|
|
40
40
|
unless true then eval false else eval true
|
|
41
41
|
assert "expected else to run after a 'then' action"
|
|
42
|
+
|
|
43
|
+
#
|
|
44
|
+
# unless is the exact opposite of if: the [bool] rule decides.
|
|
45
|
+
#
|
|
46
|
+
s [string] :
|
|
47
|
+
ran [string] :
|
|
48
|
+
|
|
49
|
+
blank_runs_do [test] :
|
|
50
|
+
description [string] : A blank value is false, so the do block runs.
|
|
51
|
+
on_test [script] :
|
|
52
|
+
put '' into ^^.s
|
|
53
|
+
unless ^^.s do put 'do' into ^^.ran else put 'else' into ^^.ran
|
|
54
|
+
eval ^^.ran = 'do'
|
|
55
|
+
assert "expected blank to run the do block"
|
|
56
|
+
|
|
57
|
+
other_text_runs_do [test] :
|
|
58
|
+
description [string] : Text that is neither true nor false is false, with a warning, so do runs.
|
|
59
|
+
expect_errors [bool] : true
|
|
60
|
+
on_test [script] :
|
|
61
|
+
put 'abc' into ^^.s
|
|
62
|
+
unless ^^.s do put 'do' into ^^.ran else put 'else' into ^^.ran
|
|
63
|
+
eval ^^.ran = 'do'
|
|
64
|
+
assert "expected other text to run the do block"
|
|
65
|
+
|
|
66
|
+
the_text_true_runs_else [test] :
|
|
67
|
+
description [string] : The text 'true' counts as true, so else runs.
|
|
68
|
+
on_test [script] :
|
|
69
|
+
put 'true' into ^^.s
|
|
70
|
+
unless ^^.s do put 'do' into ^^.ran else put 'else' into ^^.ran
|
|
71
|
+
eval ^^.ran = 'else'
|
|
72
|
+
assert "expected the text true to run else"
|
|
73
|
+
|
|
74
|
+
failed_condition_runs_neither [test] :
|
|
75
|
+
description [string] : A condition that reports an error abandons the line; else doesn't run.
|
|
76
|
+
expect_errors [bool] : true
|
|
77
|
+
on_test [script] :
|
|
78
|
+
put '' into ^^.ran
|
|
79
|
+
unless no.such.obj do put 'do' into ^^.ran else put 'else' into ^^.ran
|
|
80
|
+
eval ^^.ran = ''
|
|
81
|
+
assert "expected neither branch to run"
|
|
@@ -19,8 +19,8 @@ tests.verbs.unload [can] :
|
|
|
19
19
|
refute "temp should be gone after unload"
|
|
20
20
|
|
|
21
21
|
#
|
|
22
|
-
# The unload verb takes no object: 'unload x'
|
|
23
|
-
# is unloaded. (If this ever regressed, it would unload the test run.)
|
|
22
|
+
# The unload verb takes no object (only lib or ext and a name): 'unload x'
|
|
23
|
+
# is an error, and nothing is unloaded. (If this ever regressed, it would unload the test run.)
|
|
24
24
|
#
|
|
25
25
|
|
|
26
26
|
tests.verbs.unload_no_object [can] :
|
|
@@ -47,8 +47,66 @@ tests.verbs.unload_no_object [can] :
|
|
|
47
47
|
eval ^^.err_fired = true
|
|
48
48
|
assert "expected unload with an object to be an error"
|
|
49
49
|
|
|
50
|
-
eval ^^.error_data.message = "unload takes
|
|
50
|
+
eval ^^.error_data.message = "unload takes nothing, or lib or ext and a name, so nothing was unloaded; to unload one object, use tell x to unload."
|
|
51
51
|
assert "expected the error to point to tell x to unload"
|
|
52
52
|
|
|
53
53
|
exists? instance tests.verbs.unload_no_object.temp
|
|
54
54
|
assert "expected temp to still be loaded"
|
|
55
|
+
|
|
56
|
+
#
|
|
57
|
+
# unload lib: a library's verbs and object types are removed, and
|
|
58
|
+
# load lib brings them back. Each test loads md again before it ends,
|
|
59
|
+
# so the other tests (and files) find it as they expect.
|
|
60
|
+
#
|
|
61
|
+
|
|
62
|
+
tests.verbs.unload_lib [can] :
|
|
63
|
+
|
|
64
|
+
name [string] : md
|
|
65
|
+
|
|
66
|
+
unload_lib_removes_its_types [test] :
|
|
67
|
+
description [string] : unload lib md removes the markdown type; load lib md brings it back.
|
|
68
|
+
on_test [script] :
|
|
69
|
+
load lib md
|
|
70
|
+
exists? object markdown
|
|
71
|
+
assert "expected markdown to be registered after load lib md"
|
|
72
|
+
|
|
73
|
+
unload lib md
|
|
74
|
+
exists? object markdown
|
|
75
|
+
refute "expected markdown to be gone after unload lib md"
|
|
76
|
+
|
|
77
|
+
load lib md
|
|
78
|
+
exists? object markdown
|
|
79
|
+
assert "expected markdown to be back after load lib md"
|
|
80
|
+
|
|
81
|
+
unload_lib_computed_name [test] :
|
|
82
|
+
description [string] : the library name can be worked out, as with load.
|
|
83
|
+
on_test [script] :
|
|
84
|
+
load lib md
|
|
85
|
+
unload lib ( ^^.name )
|
|
86
|
+
exists? object markdown
|
|
87
|
+
refute "expected unload lib ( name ) to unload md"
|
|
88
|
+
load lib md
|
|
89
|
+
|
|
90
|
+
unload_lib_in_use [test] :
|
|
91
|
+
description [string] : a library can't be unloaded while objects of its types are on the heap.
|
|
92
|
+
expect_errors [bool] : true
|
|
93
|
+
on_test [script] :
|
|
94
|
+
load lib md
|
|
95
|
+
create tests.verbs.unload_lib.doc as markdown
|
|
96
|
+
unload lib md
|
|
97
|
+
refute "expected it to be false when the library is in use"
|
|
98
|
+
|
|
99
|
+
exists? object markdown
|
|
100
|
+
assert "expected markdown to still be registered"
|
|
101
|
+
|
|
102
|
+
tell tests.verbs.unload_lib.doc to unload
|
|
103
|
+
|
|
104
|
+
unload_pinned_lib [test] :
|
|
105
|
+
description [string] : gloo-test, loaded by gloo itself for the run, can't be unloaded.
|
|
106
|
+
expect_errors [bool] : true
|
|
107
|
+
on_test [script] :
|
|
108
|
+
unload lib test
|
|
109
|
+
refute "expected it to be false for a pinned library"
|
|
110
|
+
|
|
111
|
+
exists? verb assert
|
|
112
|
+
assert "expected assert to still be registered"
|
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.
|
|
4
|
+
version: '7.3'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Crane
|
|
@@ -334,6 +334,7 @@ files:
|
|
|
334
334
|
- lib/gloo/exec/action.rb
|
|
335
335
|
- lib/gloo/exec/dispatch.rb
|
|
336
336
|
- lib/gloo/exec/exec_env.rb
|
|
337
|
+
- lib/gloo/exec/runaway_recursion.rb
|
|
337
338
|
- lib/gloo/exec/runner.rb
|
|
338
339
|
- lib/gloo/exec/script.rb
|
|
339
340
|
- lib/gloo/exec/stack.rb
|
|
@@ -373,6 +374,7 @@ files:
|
|
|
373
374
|
- lib/gloo/objs/ctrl/each_word.rb
|
|
374
375
|
- lib/gloo/objs/ctrl/function.rb
|
|
375
376
|
- lib/gloo/objs/ctrl/repeat.rb
|
|
377
|
+
- lib/gloo/objs/ctrl/until.rb
|
|
376
378
|
- lib/gloo/objs/dt/date.rb
|
|
377
379
|
- lib/gloo/objs/dt/datetime.rb
|
|
378
380
|
- lib/gloo/objs/dt/dt_tools.rb
|
|
@@ -451,9 +453,11 @@ files:
|
|
|
451
453
|
- test.gloo/app/fixtures/exit_after_error.gloo
|
|
452
454
|
- test.gloo/basic.test.gloo
|
|
453
455
|
- test.gloo/ctrl/each.test.gloo
|
|
456
|
+
- test.gloo/ctrl/until.test.gloo
|
|
454
457
|
- test.gloo/dt/date.test.gloo
|
|
455
458
|
- test.gloo/dt/datetime.test.gloo
|
|
456
459
|
- test.gloo/dt/time.test.gloo
|
|
460
|
+
- test.gloo/lang/computed_paths.test.gloo
|
|
457
461
|
- test.gloo/lang/continuation.test.gloo
|
|
458
462
|
- test.gloo/lang/convert.test.gloo
|
|
459
463
|
- test.gloo/lang/declaration.test.gloo
|
|
@@ -468,6 +472,7 @@ files:
|
|
|
468
472
|
- test.gloo/lang/load_lib_directive.test.gloo
|
|
469
473
|
- test.gloo/lang/naming.test.gloo
|
|
470
474
|
- test.gloo/lang/ops.test.gloo
|
|
475
|
+
- test.gloo/lang/runaway_recursion.test.gloo
|
|
471
476
|
- test.gloo/lang/shorthand.test.gloo
|
|
472
477
|
- test.gloo/math/add.test.gloo
|
|
473
478
|
- test.gloo/math/div.test.gloo
|