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
|
@@ -6,67 +6,65 @@
|
|
|
6
6
|
# child is the id and whose second child is the name.
|
|
7
7
|
#
|
|
8
8
|
|
|
9
|
-
tests [can] :
|
|
10
|
-
objs [can] :
|
|
11
|
-
outline [can] :
|
|
9
|
+
tests.objs.outline [can] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
src [container] :
|
|
12
|
+
1 [container] :
|
|
13
|
+
id [int] : 1
|
|
14
|
+
name [string] : a/b/c
|
|
15
|
+
2 [container] :
|
|
16
|
+
id [int] : 2
|
|
17
|
+
name [string] : a/b/d
|
|
18
|
+
3 [container] :
|
|
19
|
+
id [int] : 3
|
|
20
|
+
name [string] : top
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
dotted [container] :
|
|
23
|
+
1 [container] :
|
|
24
|
+
id [int] : 9
|
|
25
|
+
name [string] : x.y.z
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
linked [outline] :
|
|
28
|
+
object_source [alias] : tests.objs.outline.src
|
|
29
|
+
entity_path [string] : /entity/
|
|
30
|
+
separator_char [string] : /
|
|
31
|
+
data [string] :
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
plain [outline] :
|
|
34
|
+
object_source [alias] : tests.objs.outline.dotted
|
|
35
|
+
separator_char [string] : .
|
|
36
|
+
data [string] :
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
builds_nested_html_with_links [test] :
|
|
39
|
+
description [string] : generate nests shared path segments and links leaves that have an id.
|
|
40
|
+
on_test [script] :
|
|
41
|
+
tell ^^.linked to generate
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
check ^^.linked.data for starts_with? ( "<ul>" )
|
|
44
|
+
assert "expected the outline to start with <ul>"
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
check ^^.linked.data for substring? ( "<li>a</li>" )
|
|
47
|
+
assert "expected a shared 'a' segment as a plain node"
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
check ^^.linked.data for substring? ( "<li>b</li>" )
|
|
50
|
+
assert "expected a shared 'b' segment as a plain node"
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
check ^^.linked.data for substring? ( "<a href='/entity/1'>c</a>" )
|
|
53
|
+
assert "expected leaf 'c' to be linked with its id and entity_path"
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
check ^^.linked.data for substring? ( "<a href='/entity/3'>top</a>" )
|
|
56
|
+
assert "expected the top-level 'top' item to be linked"
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
custom_separator_and_no_links [test] :
|
|
59
|
+
description [string] : separator_char sets the split char; with no entity_path leaves are plain.
|
|
60
|
+
on_test [script] :
|
|
61
|
+
tell ^^.plain to generate
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
check ^^.plain.data for substring? ( "<li>x</li>" )
|
|
64
|
+
assert "expected '.' to split x.y.z so 'x' is its own node"
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
check ^^.plain.data for substring? ( "<li>z</li>" )
|
|
67
|
+
assert "expected leaf 'z' rendered plain (no entity_path)"
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
check ^^.plain.data for substring? ( "href" )
|
|
70
|
+
refute "expected no links when entity_path is not set"
|
|
@@ -2,39 +2,37 @@
|
|
|
2
2
|
# Password object tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
eval it = 20
|
|
40
|
-
assert "expected the generated length to be 20"
|
|
5
|
+
tests.objs.password [can] :
|
|
6
|
+
|
|
7
|
+
hash_and_check [test] :
|
|
8
|
+
description [string] : check succeeds for the right password and fails for the wrong one.
|
|
9
|
+
on_test [script] :
|
|
10
|
+
create tests.objs.password.p as password
|
|
11
|
+
put 'user-1' into tests.objs.password.p.salt
|
|
12
|
+
put 's3cret' into tests.objs.password.p.password
|
|
13
|
+
tell tests.objs.password.p to hash
|
|
14
|
+
|
|
15
|
+
check tests.objs.password.p.hash for blank?
|
|
16
|
+
refute "expected hash to be populated"
|
|
17
|
+
|
|
18
|
+
tell tests.objs.password.p to check
|
|
19
|
+
assert "expected check to pass for the original password"
|
|
20
|
+
|
|
21
|
+
put 'not the password' into tests.objs.password.p.password
|
|
22
|
+
tell tests.objs.password.p to check
|
|
23
|
+
refute "expected check to fail for a wrong password"
|
|
24
|
+
|
|
25
|
+
generate_length [test] :
|
|
26
|
+
description [string] : generate makes a password of the requested length and puts it in it.
|
|
27
|
+
on_test [script] :
|
|
28
|
+
create tests.objs.password.g as password
|
|
29
|
+
|
|
30
|
+
tell tests.objs.password.g to generate
|
|
31
|
+
tell tests.objs.password.g.password to size
|
|
32
|
+
eval it = 7
|
|
33
|
+
assert "expected the default generated length to be 7"
|
|
34
|
+
|
|
35
|
+
tell tests.objs.password.g to generate ( 20 )
|
|
36
|
+
tell tests.objs.password.g.password to size
|
|
37
|
+
eval it = 20
|
|
38
|
+
assert "expected the generated length to be 20"
|
|
@@ -2,47 +2,45 @@
|
|
|
2
2
|
# Repeat object tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
eval ^^.count = 0
|
|
48
|
-
assert "expected the do script not to run when times is 0"
|
|
5
|
+
tests.objs.repeat [can] :
|
|
6
|
+
|
|
7
|
+
count [int] : 0
|
|
8
|
+
seen [string] :
|
|
9
|
+
|
|
10
|
+
loop [repeat] :
|
|
11
|
+
times [integer] : 4
|
|
12
|
+
index [integer] : 0
|
|
13
|
+
do [script] :
|
|
14
|
+
put tests.objs.repeat.count + 1 into tests.objs.repeat.count
|
|
15
|
+
put tests.objs.repeat.seen + tests.objs.repeat.loop.index into tests.objs.repeat.seen
|
|
16
|
+
|
|
17
|
+
zero [repeat] :
|
|
18
|
+
times [integer] : 0
|
|
19
|
+
index [integer] : 0
|
|
20
|
+
do [script] :
|
|
21
|
+
put tests.objs.repeat.count + 100 into tests.objs.repeat.count
|
|
22
|
+
|
|
23
|
+
runs_the_do_script_n_times [test] :
|
|
24
|
+
description [string] : run executes 'do' once per 'times', and 'index' walks 0..times-1.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
put 0 into ^^.count
|
|
27
|
+
put '' into ^^.seen
|
|
28
|
+
|
|
29
|
+
tell ^^.loop to run
|
|
30
|
+
|
|
31
|
+
eval ^^.count = 4
|
|
32
|
+
assert "expected the do script to run 4 times"
|
|
33
|
+
|
|
34
|
+
eval ^^.seen = '0123'
|
|
35
|
+
assert "expected index to be 0,1,2,3 across the iterations"
|
|
36
|
+
|
|
37
|
+
eval ^^.loop.index = 3
|
|
38
|
+
assert "expected index to be left at times-1 after the run"
|
|
39
|
+
|
|
40
|
+
zero_times_does_nothing [test] :
|
|
41
|
+
description [string] : run with times = 0 never executes 'do'.
|
|
42
|
+
on_test [script] :
|
|
43
|
+
put 0 into ^^.count
|
|
44
|
+
tell ^^.zero to run
|
|
45
|
+
eval ^^.count = 0
|
|
46
|
+
assert "expected the do script not to run when times is 0"
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
# Script tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
script [can] :
|
|
5
|
+
tests.objs.script [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
a [script] :
|
|
8
|
+
b [boolean] : true
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
run_script [test] :
|
|
11
|
+
description [string] : Set the value of the script
|
|
12
|
+
on_test [script] :
|
|
13
|
+
put "eval 2 + 5" into ^^.a
|
|
14
|
+
tell ^^.a to run
|
|
15
|
+
eval it = 7
|
|
16
|
+
assert "expected it to be 7"
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
put "eval ^.b = true" into ^^.a
|
|
19
|
+
run ^^.a
|
|
20
|
+
assert "expected it to be true"
|
|
23
21
|
|
|
@@ -2,97 +2,95 @@
|
|
|
2
2
|
# String tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
string [can] :
|
|
5
|
+
tests.objs.string [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
s [string] :
|
|
8
|
+
dst [can] :
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
up_down [test] :
|
|
11
|
+
description [string] : Convert string case
|
|
12
|
+
on_test [script] :
|
|
13
|
+
put 'hello' into ^^.s
|
|
14
|
+
tell ^^.s to up
|
|
15
|
+
eval ^^.s = 'HELLO'
|
|
16
|
+
assert "expected string to be uppercase"
|
|
17
|
+
tell ^^.s to down
|
|
18
|
+
eval ^^.s = 'hello'
|
|
19
|
+
assert "expected string to be lowercase"
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
trim [test] :
|
|
22
|
+
description [string] : Trim whitespace from a string
|
|
23
|
+
on_test [script] :
|
|
24
|
+
put ' hello ' into ^^.s
|
|
25
|
+
tell ^^.s to trim
|
|
26
|
+
eval it = 'hello'
|
|
27
|
+
assert "expected trimmed string to equal 'hello'"
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
sub [test] :
|
|
30
|
+
description [string] : Substitute in a string
|
|
31
|
+
on_test [script] :
|
|
32
|
+
put 'hello world' into ^^.s
|
|
33
|
+
tell ^^.s to sub ('world' 'gloo')
|
|
34
|
+
eval it = 'hello gloo'
|
|
35
|
+
assert "expected substituted string to equal 'hello gloo'"
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
count_chars [test] :
|
|
38
|
+
description [string] : Count the characters in a string
|
|
39
|
+
on_test [script] :
|
|
40
|
+
put 'hello' into ^^.s
|
|
41
|
+
tell ^^.s to count_chars
|
|
42
|
+
eval it = 5
|
|
43
|
+
assert "expected 5 characters"
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
split [test] :
|
|
46
|
+
description [string] : Get a substring between two indexes
|
|
47
|
+
on_test [script] :
|
|
48
|
+
put 'one two three' into ^^.s
|
|
49
|
+
tell ^^.s to split (4 7)
|
|
50
|
+
eval it = 'two'
|
|
51
|
+
assert "expected split (4 7) to equal 'two'"
|
|
52
|
+
eval ^^.s = 'one two three'
|
|
53
|
+
assert "expected split to leave the string unchanged"
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
splitl [test] :
|
|
56
|
+
description [string] : Get the substring to the left of an index
|
|
57
|
+
on_test [script] :
|
|
58
|
+
put 'one two three' into ^^.s
|
|
59
|
+
tell ^^.s to splitl (7)
|
|
60
|
+
eval it = 'one two'
|
|
61
|
+
assert "expected splitl (7) to equal 'one two'"
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
splitr [test] :
|
|
64
|
+
description [string] : Get the substring from an index to the end
|
|
65
|
+
on_test [script] :
|
|
66
|
+
put 'one two three' into ^^.s
|
|
67
|
+
tell ^^.s to splitr (4)
|
|
68
|
+
eval it = 'two three'
|
|
69
|
+
assert "expected splitr (4) to equal 'two three'"
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
split_out_of_range [test] :
|
|
72
|
+
description [string] : Out-of-range split indexes clamp to the string's bounds
|
|
73
|
+
on_test [script] :
|
|
74
|
+
put 'one two three' into ^^.s
|
|
75
|
+
tell ^^.s to split (-5 4)
|
|
76
|
+
eval it = 'one '
|
|
77
|
+
assert "expected split (-5 4) to clamp to 'one '"
|
|
78
|
+
tell ^^.s to split (8 100)
|
|
79
|
+
eval it = 'three'
|
|
80
|
+
assert "expected split (8 100) to clamp to 'three'"
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
split_list [test] :
|
|
83
|
+
description [string] : Split a string into children of a target container
|
|
84
|
+
on_test [script] :
|
|
85
|
+
put 'one,two,three' into ^^.s
|
|
86
|
+
tell ^^.s to split_list (',' ^^.dst)
|
|
87
|
+
eval it = 3
|
|
88
|
+
assert "expected split_list to put the part count into it"
|
|
89
|
+
eval ^^.dst.1 = 'one'
|
|
90
|
+
assert "expected dst.1 to equal 'one'"
|
|
91
|
+
eval ^^.dst.2 = 'two'
|
|
92
|
+
assert "expected dst.2 to equal 'two'"
|
|
93
|
+
eval ^^.dst.3 = 'three'
|
|
94
|
+
assert "expected dst.3 to equal 'three'"
|
|
95
|
+
eval ^^.s = 'one,two,three'
|
|
96
|
+
assert "expected split_list to leave the string unchanged"
|