gloo 6.3.1 → 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/CLAUDE.md +13 -0
- data/docs/application.md +9 -0
- data/docs/language_objects.md +78 -0
- data/docs/language_scripting.md +41 -0
- data/docs/objects.md +1 -1
- data/docs/verbs.md +36 -2
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +13 -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 +60 -1
- data/lib/gloo/core/parser.rb +30 -1
- data/lib/gloo/core/tokens.rb +44 -18
- data/lib/gloo/expr/l_string.rb +8 -4
- data/lib/gloo/objs/basic/script.rb +28 -2
- data/lib/gloo/objs/web/json.rb +4 -1
- data/lib/gloo/persist/comment_buffer.rb +58 -0
- data/lib/gloo/persist/declaration_ledger.rb +61 -0
- data/lib/gloo/persist/disc_mech.rb +15 -2
- data/lib/gloo/persist/file_loader.rb +208 -102
- data/lib/gloo/persist/file_saver.rb +251 -6
- data/lib/gloo/persist/file_storage.rb +10 -4
- data/lib/gloo/persist/indent_stack.rb +90 -0
- data/lib/gloo/persist/line_splitter.rb +18 -3
- data/lib/gloo/persist/persist_man.rb +193 -26
- data/lib/gloo/persist/script_body_collector.rb +102 -0
- data/lib/gloo/persist/shorthand_expander.rb +51 -0
- data/lib/gloo/persist/source/blank_node.rb +27 -0
- data/lib/gloo/persist/source/comment_node.rb +27 -0
- data/lib/gloo/persist/source/directive_node.rb +26 -0
- data/lib/gloo/persist/source/obj_node.rb +91 -0
- data/lib/gloo/persist/source/source_doc.rb +41 -0
- data/lib/gloo/verbs/list.rb +24 -2
- data/lib/gloo/verbs/load.rb +9 -1
- data/lib/gloo/verbs/reload.rb +3 -0
- data/lib/gloo/verbs/save.rb +57 -10
- 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 +27 -0
- 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 +57 -50
- 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/string/str.test.gloo +15 -0
- 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 +55 -0
- data/test.gloo/verbs/run.test.gloo +8 -10
- data/test.gloo/verbs/save.test.gloo +111 -0
- 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 +14 -1
|
@@ -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'"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Reload message tests -- 'tell {obj} to reload' re-reads the file.
|
|
3
|
+
#
|
|
4
|
+
# The bare 'reload' verb restarts the engine (covered by the unit
|
|
5
|
+
# tests). These exercise per-object reload against a /tmp scratch file
|
|
6
|
+
# that gets rewritten between load and reload.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
tests.verbs.reload [can] :
|
|
10
|
+
|
|
11
|
+
f [file] : /tmp/gloo_reload_test.gloo
|
|
12
|
+
v1 [text] : BEGIN
|
|
13
|
+
demo [container] :
|
|
14
|
+
msg [string] : original
|
|
15
|
+
END
|
|
16
|
+
|
|
17
|
+
v2 [text] : BEGIN
|
|
18
|
+
demo [container] :
|
|
19
|
+
msg [string] : edited outside gloo
|
|
20
|
+
added [string] : brand new
|
|
21
|
+
END
|
|
22
|
+
|
|
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"
|
|
30
|
+
|
|
31
|
+
tell ^^.f to write ( ^^.v2 )
|
|
32
|
+
tell demo to reload
|
|
33
|
+
|
|
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"
|
|
38
|
+
|
|
39
|
+
tell demo to unload
|
|
40
|
+
tell ^^.f to delete
|
|
41
|
+
|
|
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
|
|
47
|
+
|
|
48
|
+
put 'not saved' into demo.msg
|
|
49
|
+
tell demo to reload
|
|
50
|
+
|
|
51
|
+
eval demo.msg = 'original'
|
|
52
|
+
assert "reload should restore the on-disk value"
|
|
53
|
+
|
|
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"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Save verb tests -- real load -> edit -> save round trips.
|
|
3
|
+
#
|
|
4
|
+
# Each test writes a .gloo fixture to /tmp, loads it, does something,
|
|
5
|
+
# saves, reads the file back, and asserts on the raw text. Every test
|
|
6
|
+
# unloads its object and deletes its scratch file at the end so the
|
|
7
|
+
# next one starts clean.
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
tests.verbs.save [can] :
|
|
11
|
+
|
|
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
|
|
17
|
+
|
|
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
|
|
26
|
+
#
|
|
27
|
+
# a comment above demo
|
|
28
|
+
#
|
|
29
|
+
demo [container] :
|
|
30
|
+
msg [string] : hello
|
|
31
|
+
# a comment above other
|
|
32
|
+
other [string] : world
|
|
33
|
+
END
|
|
34
|
+
|
|
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
|
|
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"
|
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: 6.
|
|
4
|
+
version: 6.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Crane
|
|
@@ -384,12 +384,22 @@ files:
|
|
|
384
384
|
- lib/gloo/objs/web/http_post.rb
|
|
385
385
|
- lib/gloo/objs/web/json.rb
|
|
386
386
|
- lib/gloo/objs/web/uri.rb
|
|
387
|
+
- lib/gloo/persist/comment_buffer.rb
|
|
388
|
+
- lib/gloo/persist/declaration_ledger.rb
|
|
387
389
|
- lib/gloo/persist/disc_mech.rb
|
|
388
390
|
- lib/gloo/persist/file_loader.rb
|
|
389
391
|
- lib/gloo/persist/file_saver.rb
|
|
390
392
|
- lib/gloo/persist/file_storage.rb
|
|
393
|
+
- lib/gloo/persist/indent_stack.rb
|
|
391
394
|
- lib/gloo/persist/line_splitter.rb
|
|
392
395
|
- lib/gloo/persist/persist_man.rb
|
|
396
|
+
- lib/gloo/persist/script_body_collector.rb
|
|
397
|
+
- lib/gloo/persist/shorthand_expander.rb
|
|
398
|
+
- lib/gloo/persist/source/blank_node.rb
|
|
399
|
+
- lib/gloo/persist/source/comment_node.rb
|
|
400
|
+
- lib/gloo/persist/source/directive_node.rb
|
|
401
|
+
- lib/gloo/persist/source/obj_node.rb
|
|
402
|
+
- lib/gloo/persist/source/source_doc.rb
|
|
393
403
|
- lib/gloo/plugin/base.rb
|
|
394
404
|
- lib/gloo/plugin/callback.rb
|
|
395
405
|
- lib/gloo/plugin/ext_manager.rb
|
|
@@ -443,6 +453,7 @@ files:
|
|
|
443
453
|
- test.gloo/lang/load_lib_directive.test.gloo
|
|
444
454
|
- test.gloo/lang/naming.test.gloo
|
|
445
455
|
- test.gloo/lang/ops.test.gloo
|
|
456
|
+
- test.gloo/lang/shorthand.test.gloo
|
|
446
457
|
- test.gloo/math/add.test.gloo
|
|
447
458
|
- test.gloo/math/div.test.gloo
|
|
448
459
|
- test.gloo/math/mult.test.gloo
|
|
@@ -481,7 +492,9 @@ files:
|
|
|
481
492
|
- test.gloo/verbs/log.test.gloo
|
|
482
493
|
- test.gloo/verbs/move.test.gloo
|
|
483
494
|
- test.gloo/verbs/put.test.gloo
|
|
495
|
+
- test.gloo/verbs/reload.test.gloo
|
|
484
496
|
- test.gloo/verbs/run.test.gloo
|
|
497
|
+
- test.gloo/verbs/save.test.gloo
|
|
485
498
|
- test.gloo/verbs/show.test.gloo
|
|
486
499
|
- test.gloo/verbs/tell.test.gloo
|
|
487
500
|
- test.gloo/verbs/throw.test.gloo
|