gloo 6.4.0 → 6.5.0
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 +7 -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 +4 -1
- 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
|
@@ -7,29 +7,22 @@
|
|
|
7
7
|
# next one starts clean.
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
tests [can] :
|
|
11
|
-
verbs [can] :
|
|
12
|
-
save [can] :
|
|
13
|
-
f [file] : /tmp/gloo_save_test.gloo
|
|
14
|
-
g [file] : /tmp/gloo_save_test_2.gloo
|
|
15
|
-
to_target [file] : /tmp/gloo_save_test_to.gloo
|
|
16
|
-
out [string] : BEGIN
|
|
17
|
-
#
|
|
18
|
-
# a comment above demo
|
|
19
|
-
#
|
|
20
|
-
demo [container] :
|
|
21
|
-
msg [string] : hello
|
|
22
|
-
END
|
|
23
|
-
err [bool] : false
|
|
10
|
+
tests.verbs.save [can] :
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
f [file] : /tmp/gloo_save_test.gloo
|
|
13
|
+
g [file] : /tmp/gloo_save_test_2.gloo
|
|
14
|
+
to_target [file] : /tmp/gloo_save_test_to.gloo
|
|
15
|
+
out [string] :
|
|
16
|
+
err [bool] : false
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
on_error [script] :
|
|
19
|
+
put true into ^.err
|
|
20
|
+
|
|
21
|
+
#
|
|
22
|
+
# The fixture used by most tests: two comments, a changed-in-place
|
|
23
|
+
# value, and an untouched sibling.
|
|
24
|
+
#
|
|
25
|
+
fixture [text] : BEGIN
|
|
33
26
|
#
|
|
34
27
|
# a comment above demo
|
|
35
28
|
#
|
|
@@ -39,77 +32,80 @@ demo [container] :
|
|
|
39
32
|
other [string] : world
|
|
40
33
|
END
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
tell ^^.f to write ( ^^.fixture )
|
|
106
|
-
load /tmp/gloo_save_test.gloo
|
|
107
|
-
put 'not saved' into demo.msg
|
|
108
|
-
eval demo.msg = 'not saved'
|
|
109
|
-
assert "sanity: the edit landed"
|
|
110
|
-
tell demo to reload
|
|
111
|
-
eval demo.msg = 'hello'
|
|
112
|
-
assert "reload should restore the on-disk value"
|
|
113
|
-
tell demo to unload
|
|
114
|
-
tell ^^.f to delete
|
|
35
|
+
round_trip_preserves_comments_and_untouched_lines [test] :
|
|
36
|
+
description [string] : load, change one value, save -- comments and the untouched sibling survive.
|
|
37
|
+
on_test [script] :
|
|
38
|
+
put false into ^^.err
|
|
39
|
+
tell ^^.f to write ( ^^.fixture )
|
|
40
|
+
load /tmp/gloo_save_test.gloo
|
|
41
|
+
put 'changed' into demo.msg
|
|
42
|
+
save demo
|
|
43
|
+
eval ^^.err = false
|
|
44
|
+
assert "save should not error"
|
|
45
|
+
tell ^^.f to read ( ^^.out )
|
|
46
|
+
check ^^.out for substring? ( "# a comment above demo" )
|
|
47
|
+
assert "the leading comment block should survive"
|
|
48
|
+
check ^^.out for substring? ( "# a comment above other" )
|
|
49
|
+
assert "the inner comment should survive"
|
|
50
|
+
check ^^.out for substring? ( "msg [string] : changed" )
|
|
51
|
+
assert "the changed value should be written"
|
|
52
|
+
check ^^.out for substring? ( "other [string] : world" )
|
|
53
|
+
assert "the untouched sibling should be unchanged"
|
|
54
|
+
tell demo to unload
|
|
55
|
+
tell ^^.f to delete
|
|
56
|
+
|
|
57
|
+
unchanged_file_round_trips_byte_for_byte [test] :
|
|
58
|
+
description [string] : load then save with no change reproduces the file exactly.
|
|
59
|
+
on_test [script] :
|
|
60
|
+
tell ^^.f to write ( ^^.fixture )
|
|
61
|
+
load /tmp/gloo_save_test.gloo
|
|
62
|
+
save demo
|
|
63
|
+
tell ^^.f to read ( ^^.out )
|
|
64
|
+
eval ^^.out = ^^.fixture
|
|
65
|
+
assert "an unchanged save should reproduce the original text"
|
|
66
|
+
tell demo to unload
|
|
67
|
+
tell ^^.f to delete
|
|
68
|
+
|
|
69
|
+
deleting_an_object_drops_its_line [test] :
|
|
70
|
+
description [string] : removing a child and saving drops just that declaration.
|
|
71
|
+
on_test [script] :
|
|
72
|
+
tell ^^.f to write ( ^^.fixture )
|
|
73
|
+
load /tmp/gloo_save_test.gloo
|
|
74
|
+
tell demo.other to unload
|
|
75
|
+
save demo
|
|
76
|
+
tell ^^.f to read ( ^^.out )
|
|
77
|
+
check ^^.out for substring? ( "msg [string] : hello" )
|
|
78
|
+
assert "the kept sibling should still be there"
|
|
79
|
+
check ^^.out for substring? ( "other [string]" )
|
|
80
|
+
refute "the removed child's line should be gone"
|
|
81
|
+
tell demo to unload
|
|
82
|
+
tell ^^.f to delete
|
|
83
|
+
|
|
84
|
+
save_to_a_new_path_creates_the_file [test] :
|
|
85
|
+
description [string] : save {obj} to {path} writes a new file and registers it.
|
|
86
|
+
on_test [script] :
|
|
87
|
+
tell ^^.f to write ( ^^.fixture )
|
|
88
|
+
load /tmp/gloo_save_test.gloo
|
|
89
|
+
save demo to /tmp/gloo_save_test_to
|
|
90
|
+
check ^^.to_target for exists?
|
|
91
|
+
assert "save ... to should create the target file"
|
|
92
|
+
tell ^^.to_target to read ( ^^.out )
|
|
93
|
+
check ^^.out for substring? ( "msg [string] : hello" )
|
|
94
|
+
assert "the new file should hold the object"
|
|
95
|
+
tell demo to unload
|
|
96
|
+
tell ^^.f to delete
|
|
97
|
+
tell ^^.to_target to delete
|
|
115
98
|
|
|
99
|
+
reload_discards_unsaved_changes [test] :
|
|
100
|
+
description [string] : reload throws away edits that were not saved.
|
|
101
|
+
on_test [script] :
|
|
102
|
+
tell ^^.f to write ( ^^.fixture )
|
|
103
|
+
load /tmp/gloo_save_test.gloo
|
|
104
|
+
put 'not saved' into demo.msg
|
|
105
|
+
eval demo.msg = 'not saved'
|
|
106
|
+
assert "sanity: the edit landed"
|
|
107
|
+
tell demo to reload
|
|
108
|
+
eval demo.msg = 'hello'
|
|
109
|
+
assert "reload should restore the on-disk value"
|
|
110
|
+
tell demo to unload
|
|
111
|
+
tell ^^.f to delete
|
|
@@ -2,36 +2,34 @@
|
|
|
2
2
|
# Show verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
show [can] :
|
|
5
|
+
tests.verbs.show [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
msg [string] : hello
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
show_literal [test] :
|
|
10
|
+
description [string] : Show a literal sets it to that literal.
|
|
11
|
+
on_test [script] :
|
|
12
|
+
show 'hello'
|
|
13
|
+
eval it = 'hello'
|
|
14
|
+
assert "expected it to be 'hello'"
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
show_object [test] :
|
|
17
|
+
description [string] : Show an object sets it to the object's value.
|
|
18
|
+
on_test [script] :
|
|
19
|
+
show ^^.msg
|
|
20
|
+
eval it = 'hello'
|
|
21
|
+
assert "expected it to be the value of msg"
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
show_expression [test] :
|
|
24
|
+
description [string] : Show evaluates an expression before showing it.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
show 3 + 4
|
|
27
|
+
eval it = 7
|
|
28
|
+
assert "expected it to be 7"
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
show_concat [test] :
|
|
31
|
+
description [string] : Show evaluates a string concatenation.
|
|
32
|
+
on_test [script] :
|
|
33
|
+
show 'a' + 'b'
|
|
34
|
+
eval it = 'ab'
|
|
35
|
+
assert "expected it to be 'ab'"
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
# Tell verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
tell [can] :
|
|
5
|
+
tests.verbs.tell [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
s [string] : abc123d
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
tell [test] :
|
|
10
|
+
description [string] : Tell verb sets value to it
|
|
11
|
+
on_test [script] :
|
|
12
|
+
tell ^^.s to count_chars
|
|
13
|
+
eval it = 7
|
|
14
|
+
assert "expected it to be 7"
|
|
@@ -9,36 +9,34 @@
|
|
|
9
9
|
# the console by design.
|
|
10
10
|
#
|
|
11
11
|
|
|
12
|
-
tests [can] :
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
eval tests.verbs.throw.caught = 'boom 42'
|
|
44
|
-
assert "expected the evaluated custom message"
|
|
12
|
+
tests.verbs.throw [can] :
|
|
13
|
+
|
|
14
|
+
on_exception [script] :
|
|
15
|
+
put ^.exception_data.message into ^.caught
|
|
16
|
+
|
|
17
|
+
exception_data [can] :
|
|
18
|
+
message [string] :
|
|
19
|
+
backtrace [string] :
|
|
20
|
+
|
|
21
|
+
caught [string] :
|
|
22
|
+
|
|
23
|
+
default_message [test] :
|
|
24
|
+
description [string] : bare throw uses the default message and execution continues.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
put '' into tests.verbs.throw.caught
|
|
27
|
+
eval false
|
|
28
|
+
|
|
29
|
+
throw
|
|
30
|
+
eval true
|
|
31
|
+
assert "expected execution to continue after a bare throw"
|
|
32
|
+
|
|
33
|
+
eval tests.verbs.throw.caught = 'Thrown by throw verb'
|
|
34
|
+
assert "expected the default thrown message"
|
|
35
|
+
|
|
36
|
+
custom_message [test] :
|
|
37
|
+
description [string] : throw evaluates its argument as the message.
|
|
38
|
+
on_test [script] :
|
|
39
|
+
put '' into tests.verbs.throw.caught
|
|
40
|
+
throw 'boom ' + '42'
|
|
41
|
+
eval tests.verbs.throw.caught = 'boom 42'
|
|
42
|
+
assert "expected the evaluated custom message"
|
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
# Unless verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
unless [can] :
|
|
5
|
+
tests.verbs.unless [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
b [bool] : false
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
unless_false [test] :
|
|
10
|
+
description [string] : Unless false, do block runs.
|
|
11
|
+
on_test [script] :
|
|
12
|
+
unless ^^.b do eval true
|
|
13
|
+
assert "expected do block to run when condition is false"
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
unless_true [test] :
|
|
16
|
+
description [string] : Unless true, do block is skipped.
|
|
17
|
+
on_test [script] :
|
|
18
|
+
eval false
|
|
19
|
+
unless true do eval true
|
|
20
|
+
refute "expected do block to be skipped when condition is true"
|
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
# unit tests). Per-object unload is the 'unload' message, tested here.
|
|
6
6
|
#
|
|
7
7
|
|
|
8
|
-
tests [can] :
|
|
9
|
-
verbs [can] :
|
|
10
|
-
unload [can] :
|
|
8
|
+
tests.verbs.unload [can] :
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
unload_removes_object [test] :
|
|
11
|
+
description [string] : sending 'unload' to an object removes it from the tree.
|
|
12
|
+
on_test [script] :
|
|
13
|
+
create tests.verbs.unload.temp as string : 'x'
|
|
14
|
+
exists? instance tests.verbs.unload.temp
|
|
15
|
+
assert "temp should exist after create"
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
tell tests.verbs.unload.temp to unload
|
|
18
|
+
exists? instance tests.verbs.unload.temp
|
|
19
|
+
refute "temp should be gone after unload"
|