gloo 6.4.0 → 6.5.1
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 +9 -0
- data/docs/language_objects.md +40 -0
- data/docs/objects.md +1 -1
- data/docs/verbs.md +9 -0
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +11 -0
- data/lib/gloo/app/engine.rb +5 -1
- data/lib/gloo/app/log.rb +5 -5
- data/lib/gloo/app/settings.rb +4 -1
- data/lib/gloo/core/obj.rb +21 -1
- data/lib/gloo/persist/file_loader.rb +7 -0
- data/lib/gloo/persist/persist_man.rb +35 -3
- data/lib/gloo/persist/source/obj_node.rb +41 -0
- data/lib/gloo/verbs/list.rb +24 -2
- data/lib/gloo/verbs/load.rb +13 -2
- data/test.gloo/ctrl/each.test.gloo +28 -30
- data/test.gloo/dt/date.test.gloo +69 -71
- data/test.gloo/dt/datetime.test.gloo +55 -57
- data/test.gloo/dt/time.test.gloo +70 -72
- data/test.gloo/lang/continuation.test.gloo +25 -27
- data/test.gloo/lang/convert.test.gloo +50 -52
- data/test.gloo/lang/dt_comparisons.test.gloo +87 -89
- data/test.gloo/lang/exceptions.test.gloo +42 -44
- data/test.gloo/lang/gloo_sys.test.gloo +100 -102
- data/test.gloo/lang/here.test.gloo +32 -34
- data/test.gloo/lang/it.test.gloo +27 -29
- data/test.gloo/lang/literal.test.gloo +55 -57
- data/test.gloo/lang/load_lib_directive.test.gloo +18 -20
- data/test.gloo/lang/naming.test.gloo +28 -30
- data/test.gloo/lang/ops.test.gloo +53 -55
- data/test.gloo/lang/shorthand.test.gloo +15 -17
- data/test.gloo/math/add.test.gloo +40 -42
- data/test.gloo/math/div.test.gloo +23 -25
- data/test.gloo/math/mult.test.gloo +23 -25
- data/test.gloo/math/sub.test.gloo +23 -25
- data/test.gloo/objs/alias.test.gloo +15 -17
- data/test.gloo/objs/bool.test.gloo +54 -56
- data/test.gloo/objs/can.test.gloo +33 -35
- data/test.gloo/objs/cipher.test.gloo +39 -41
- data/test.gloo/objs/decimal.test.gloo +27 -29
- data/test.gloo/objs/erb.test.gloo +47 -49
- data/test.gloo/objs/file.test.gloo +68 -70
- data/test.gloo/objs/function.test.gloo +37 -39
- data/test.gloo/objs/int.test.gloo +54 -56
- data/test.gloo/objs/json.test.gloo +56 -58
- data/test.gloo/objs/obj.test.gloo +68 -48
- data/test.gloo/objs/outline.test.gloo +48 -50
- data/test.gloo/objs/password.test.gloo +34 -36
- data/test.gloo/objs/repeat.test.gloo +42 -44
- data/test.gloo/objs/script.test.gloo +13 -15
- data/test.gloo/objs/string.test.gloo +82 -84
- data/test.gloo/objs/text.test.gloo +90 -92
- data/test.gloo/objs/untyped.test.gloo +36 -38
- data/test.gloo/objs/uri.test.gloo +37 -39
- data/test.gloo/verbs/break.test.gloo +12 -14
- data/test.gloo/verbs/check.test.gloo +22 -24
- data/test.gloo/verbs/context.test.gloo +11 -13
- data/test.gloo/verbs/create.test.gloo +7 -9
- data/test.gloo/verbs/eval.test.gloo +10 -12
- data/test.gloo/verbs/exists.test.gloo +43 -45
- data/test.gloo/verbs/if.test.gloo +8 -10
- data/test.gloo/verbs/invoke.test.gloo +73 -75
- data/test.gloo/verbs/list.test.gloo +21 -23
- data/test.gloo/verbs/load.test.gloo +27 -21
- data/test.gloo/verbs/log.test.gloo +7 -9
- data/test.gloo/verbs/move.test.gloo +12 -14
- data/test.gloo/verbs/put.test.gloo +10 -12
- data/test.gloo/verbs/reload.test.gloo +30 -32
- data/test.gloo/verbs/run.test.gloo +8 -10
- data/test.gloo/verbs/save.test.gloo +90 -94
- data/test.gloo/verbs/show.test.gloo +26 -28
- data/test.gloo/verbs/tell.test.gloo +8 -10
- data/test.gloo/verbs/throw.test.gloo +31 -33
- data/test.gloo/verbs/unless.test.gloo +13 -15
- data/test.gloo/verbs/unload.test.gloo +10 -12
- metadata +1 -1
|
@@ -2,92 +2,90 @@
|
|
|
2
2
|
# Invoke verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
invoke [can] :
|
|
5
|
+
tests.verbs.invoke [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
f [ƒ] :
|
|
8
|
+
params [can] :
|
|
9
|
+
on_invoke [script] :
|
|
10
|
+
put 42 into ^.result
|
|
11
|
+
result [int] :
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
invoke_test [test] :
|
|
14
|
+
description [string] : Invoke a function and check the result.
|
|
15
|
+
on_test [script] :
|
|
16
|
+
invoke tests.verbs.invoke.f
|
|
17
|
+
eval it = 42
|
|
18
|
+
assert "expected it to be 42"
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
add [ƒ] :
|
|
21
|
+
on_invoke [script] :
|
|
22
|
+
put ^.params.x + ^.params.y into ^.result
|
|
23
|
+
params [can] :
|
|
24
|
+
x [int] :
|
|
25
|
+
y [int] :
|
|
26
|
+
result [int] :
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
total [int] :
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
inline_invoke_in_show_test [test] :
|
|
31
|
+
description [string] : Inline invoke( ... ) works inside show.
|
|
32
|
+
on_test [script] :
|
|
33
|
+
show invoke( tests.verbs.invoke.add 3 4 )
|
|
34
|
+
eval it = 7
|
|
35
|
+
assert "expected it to be 7"
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
inline_shortcut_in_show_test [test] :
|
|
38
|
+
description [string] : Inline ~>( ... ) works inside show, same as invoke( ... ).
|
|
39
|
+
on_test [script] :
|
|
40
|
+
show ~>( tests.verbs.invoke.add 3 4 )
|
|
41
|
+
eval it = 7
|
|
42
|
+
assert "expected it to be 7"
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
inline_invoke_with_operator_test [test] :
|
|
45
|
+
description [string] : Inline invoke( ... ) composes with an operator.
|
|
46
|
+
on_test [script] :
|
|
47
|
+
show "Total: " + invoke( tests.verbs.invoke.add 3 4 )
|
|
48
|
+
eval it = "Total: 7"
|
|
49
|
+
assert "expected it to be 'Total: 7'"
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
inline_invoke_in_put_test [test] :
|
|
52
|
+
description [string] : Inline invoke( ... ) works inside put ... into.
|
|
53
|
+
on_test [script] :
|
|
54
|
+
put 0 into ^^.total
|
|
55
|
+
put invoke( tests.verbs.invoke.add 3 4 ) into ^^.total
|
|
56
|
+
eval ^^.total = 7
|
|
57
|
+
assert "expected total to be 7"
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
inline_invoke_in_if_test [test] :
|
|
60
|
+
description [string] : Inline invoke( ... ) works inside if.
|
|
61
|
+
on_test [script] :
|
|
62
|
+
eval false
|
|
63
|
+
if invoke( tests.verbs.invoke.add 3 4 ) = 7 then eval true
|
|
64
|
+
assert "expected the if branch to have run"
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
err_fired [bool] : false
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
on_error [script] :
|
|
69
|
+
put true into ^.err_fired
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
inline_invoke_error_test [test] :
|
|
72
|
+
description [string] : Inline invoke( ... ) reports an error for an unresolved target, same as the standalone verb.
|
|
73
|
+
on_test [script] :
|
|
74
|
+
put false into ^^.err_fired
|
|
75
|
+
show invoke( tests.verbs.invoke.no_such_function )
|
|
76
|
+
eval ^^.err_fired = true
|
|
77
|
+
assert "expected on_error to have fired for an unresolved inline call target"
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
greet [ƒ] :
|
|
80
|
+
on_invoke [script] :
|
|
81
|
+
put 'Hi, ' + ^.params.name into ^.result
|
|
82
|
+
params [can] :
|
|
83
|
+
name [string] :
|
|
84
|
+
result [string] :
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
inline_invoke_with_quoted_arg_test [test] :
|
|
87
|
+
description [string] : A quoted string arg inside invoke( ... ) is passed through as one arg, not split on its internal space.
|
|
88
|
+
on_test [script] :
|
|
89
|
+
show invoke( tests.verbs.invoke.greet "Bob Smith" )
|
|
90
|
+
eval it = "Hi, Bob Smith"
|
|
91
|
+
assert "expected it to be 'Hi, Bob Smith'"
|
|
@@ -5,30 +5,28 @@
|
|
|
5
5
|
# behaviour rather than its output.
|
|
6
6
|
#
|
|
7
7
|
|
|
8
|
-
tests [can] :
|
|
9
|
-
verbs [can] :
|
|
10
|
-
list [can] :
|
|
8
|
+
tests.verbs.list [can] :
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
data [can] :
|
|
11
|
+
a [string] : A
|
|
12
|
+
b [string] : B
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
err_fired [bool] : false
|
|
15
|
+
on_error [script] :
|
|
16
|
+
put true into ^.err_fired
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
list_real_container [test] :
|
|
19
|
+
description [string] : listing a real container does not fire on_error.
|
|
20
|
+
on_test [script] :
|
|
21
|
+
put false into ^^.err_fired
|
|
22
|
+
list tests.verbs.list.data
|
|
23
|
+
eval ^^.err_fired = false
|
|
24
|
+
assert "listing a real container should not fire on_error"
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
list_missing_target [test] :
|
|
27
|
+
description [string] : listing a missing target fires on_error.
|
|
28
|
+
on_test [script] :
|
|
29
|
+
put false into ^^.err_fired
|
|
30
|
+
list tests.verbs.list.no_such_thing
|
|
31
|
+
eval ^^.err_fired = true
|
|
32
|
+
assert "listing a missing target should fire on_error"
|
|
@@ -5,28 +5,34 @@
|
|
|
5
5
|
# its effect is observable through 'exists?'.
|
|
6
6
|
#
|
|
7
7
|
|
|
8
|
-
tests [can] :
|
|
9
|
-
verbs [can] :
|
|
10
|
-
load [can] :
|
|
8
|
+
tests.verbs.load [can] :
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
err_fired [bool] : false
|
|
11
|
+
on_error [script] :
|
|
12
|
+
put true into ^.err_fired
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
load_lib_registers_type [test] :
|
|
15
|
+
description [string] : load lib registers that library's object types.
|
|
16
|
+
on_test [script] :
|
|
17
|
+
exists? object markdown
|
|
18
|
+
refute "markdown type should not be registered before load"
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
load lib md
|
|
21
|
+
exists? object markdown
|
|
22
|
+
assert "expected the markdown type to be registered after 'load lib md'"
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
load_no_args_errors [test] :
|
|
25
|
+
description [string] : load with no arguments fires on_error.
|
|
26
|
+
on_test [script] :
|
|
27
|
+
put false into ^^.err_fired
|
|
28
|
+
load
|
|
29
|
+
eval ^^.err_fired = true
|
|
30
|
+
assert "expected 'load' with no arguments to fire on_error"
|
|
31
|
+
|
|
32
|
+
load_missing_file_errors [test] :
|
|
33
|
+
description [string] : load of a file that can't be found fires on_error.
|
|
34
|
+
on_test [script] :
|
|
35
|
+
put false into ^^.err_fired
|
|
36
|
+
load no_such_file_xyz
|
|
37
|
+
eval ^^.err_fired = true
|
|
38
|
+
assert "expected 'load' of a missing file to fire on_error"
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
# Log verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
log [can] :
|
|
5
|
+
tests.verbs.log [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
write_log [test] :
|
|
8
|
+
description [string] : Write to the log.
|
|
9
|
+
on_test [script] :
|
|
10
|
+
log 'debug' (debug)
|
|
11
|
+
eval it = 'debug'
|
|
12
|
+
assert "expected it to be 'debug'"
|
|
@@ -2,19 +2,17 @@
|
|
|
2
2
|
# Move verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
move [can] :
|
|
5
|
+
tests.verbs.move [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
c [container] :
|
|
8
|
+
a [string] : "a"
|
|
9
|
+
t [container] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
move_a [test] :
|
|
12
|
+
description [string] : Move an object and verify.
|
|
13
|
+
on_test [script] :
|
|
14
|
+
move tests.verbs.move.c.a to tests.verbs.move.t
|
|
15
|
+
exists? instance tests.verbs.move.t.a
|
|
16
|
+
assert "expected a to be in t"
|
|
17
|
+
exists? instance tests.verbs.move.c.a
|
|
18
|
+
refute "expected a not to be in c"
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
# Put verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
put [can] :
|
|
5
|
+
tests.verbs.put [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
s [string] : abc
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
put_into [test] :
|
|
10
|
+
description [string] : Assign a value.
|
|
11
|
+
on_test [script] :
|
|
12
|
+
eval ^^.s = 'abc'
|
|
13
|
+
assert 'initial value is abc'
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
put 'xyz' into ^^.s
|
|
16
|
+
eval it = ^^.s
|
|
17
|
+
assert "expected it to be 'xyz'"
|
|
@@ -6,52 +6,50 @@
|
|
|
6
6
|
# that gets rewritten between load and reload.
|
|
7
7
|
#
|
|
8
8
|
|
|
9
|
-
tests [can] :
|
|
10
|
-
verbs [can] :
|
|
11
|
-
reload [can] :
|
|
9
|
+
tests.verbs.reload [can] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
f [file] : /tmp/gloo_reload_test.gloo
|
|
12
|
+
v1 [text] : BEGIN
|
|
15
13
|
demo [container] :
|
|
16
14
|
msg [string] : original
|
|
17
15
|
END
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
v2 [text] : BEGIN
|
|
20
18
|
demo [container] :
|
|
21
19
|
msg [string] : edited outside gloo
|
|
22
20
|
added [string] : brand new
|
|
23
21
|
END
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
reload_picks_up_an_external_change [test] :
|
|
24
|
+
description [string] : editing the file on disk then reloading takes effect.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
tell ^^.f to write ( ^^.v1 )
|
|
27
|
+
load /tmp/gloo_reload_test.gloo
|
|
28
|
+
eval demo.msg = 'original'
|
|
29
|
+
assert "sanity: loaded the first version"
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
tell ^^.f to write ( ^^.v2 )
|
|
32
|
+
tell demo to reload
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
eval demo.msg = 'edited outside gloo'
|
|
35
|
+
assert "reload should pick up the changed value"
|
|
36
|
+
eval demo.added = 'brand new'
|
|
37
|
+
assert "reload should pick up a newly added child"
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
tell demo to unload
|
|
40
|
+
tell ^^.f to delete
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
reload_discards_an_in_memory_edit [test] :
|
|
43
|
+
description [string] : an unsaved change is thrown away by reload.
|
|
44
|
+
on_test [script] :
|
|
45
|
+
tell ^^.f to write ( ^^.v1 )
|
|
46
|
+
load /tmp/gloo_reload_test.gloo
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
put 'not saved' into demo.msg
|
|
49
|
+
tell demo to reload
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
eval demo.msg = 'original'
|
|
52
|
+
assert "reload should restore the on-disk value"
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
tell demo to unload
|
|
55
|
+
tell ^^.f to delete
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
# Run verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
run [can] :
|
|
5
|
+
tests.verbs.run [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
s [script] :
|
|
8
|
+
eval true
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
run [test] :
|
|
11
|
+
description [string] : Run a script.
|
|
12
|
+
on_test [script] :
|
|
13
|
+
run ^^.s
|
|
14
|
+
assert "expected it to be true"
|