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
|
@@ -2,69 +2,67 @@
|
|
|
2
2
|
# Integer tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
int [can] :
|
|
5
|
+
tests.objs.int [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
a [int] :
|
|
8
|
+
b [int] :
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
set_value_with_msg [test] :
|
|
11
|
+
description [string] : Set the value of the integer
|
|
12
|
+
on_test [script] :
|
|
13
|
+
put 1 into ^^.b
|
|
14
|
+
eval ^^.b = 1
|
|
15
|
+
assert "expected it to be 1"
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
put 2 into ^^.a
|
|
18
|
+
eval ^^.a = ^^.b
|
|
19
|
+
refute "expected them to not be equal"
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
put 1 into ^^.a
|
|
22
|
+
eval ^^.a = ^^.b
|
|
23
|
+
assert "expected them to be equal"
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
inc_int [test] :
|
|
26
|
+
description [string] : Increment the integer
|
|
27
|
+
on_test [script] :
|
|
28
|
+
put 1 into ^^.a
|
|
29
|
+
tell ^^.a to inc
|
|
30
|
+
eval ^^.a = 2
|
|
31
|
+
assert "expected it to be 2"
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
dec_int [test] :
|
|
34
|
+
description [string] : Decrement the integer
|
|
35
|
+
on_test [script] :
|
|
36
|
+
put 1 into ^^.a
|
|
37
|
+
tell ^^.a to dec
|
|
38
|
+
eval ^^.a = 0
|
|
39
|
+
assert "expected it to be 0"
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
rand_int [test] :
|
|
42
|
+
description [string] : Randomize the integer
|
|
43
|
+
on_test [script] :
|
|
44
|
+
put 1 into ^^.a
|
|
45
|
+
tell ^^.a to randomize
|
|
46
|
+
eval ^^.a >= 0
|
|
47
|
+
assert "expected it to be greater than or equal to 0"
|
|
48
|
+
eval ^^.a <= 100
|
|
49
|
+
assert "expected it to be less than or equal to 100"
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
tell ^^.a to randomize (10000)
|
|
52
|
+
tell ^^.b to randomize (10000)
|
|
53
|
+
eval ^^.a = ^^.b
|
|
54
|
+
refute "expected them to not be equal"
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
format_int [test] :
|
|
57
|
+
description [string] : Format an integer
|
|
58
|
+
f [int] :
|
|
59
|
+
on_test [script] :
|
|
60
|
+
put 1234567 into ^.f
|
|
61
|
+
tell ^.f to format
|
|
62
|
+
eval it = '1,234,567'
|
|
63
|
+
assert "expected formatted integer to match"
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
put 42 into ^.f
|
|
66
|
+
tell ^.f to format ('%05d')
|
|
67
|
+
eval it = '00042'
|
|
68
|
+
assert "expected formatted integer to match"
|
|
@@ -2,69 +2,76 @@
|
|
|
2
2
|
# JSON object tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
json [can] :
|
|
5
|
+
tests.objs.json [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
payload [json] : BEGIN
|
|
10
8
|
{ "title":"Brute Force",
|
|
11
9
|
"meta":{ "author":"ESR", "year":"2003" } }
|
|
12
10
|
END
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
compact [json] : {"a":"1","b":{"c":"2"}}
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
source [can] :
|
|
15
|
+
name [string] : gloo
|
|
16
|
+
kind [string] : language
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
built [json] :
|
|
19
|
+
out [can] :
|
|
20
|
+
found [string] :
|
|
21
|
+
assigned [json] :
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
get_a_value [test] :
|
|
24
|
+
description [string] : get pulls a value out by dotted path.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
tell ^^.payload to get ( 'title' )
|
|
27
|
+
eval it = 'Brute Force'
|
|
28
|
+
assert "expected the top-level title"
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
tell ^^.payload to get ( 'meta.author' )
|
|
31
|
+
eval it = 'ESR'
|
|
32
|
+
assert "expected the nested author"
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
get_missing_is_blank [test] :
|
|
35
|
+
description [string] : get for a path that isn't there returns blank.
|
|
36
|
+
on_test [script] :
|
|
37
|
+
tell ^^.payload to get ( 'nope' )
|
|
38
|
+
put it into tests.objs.json.found
|
|
39
|
+
check tests.objs.json.found for blank?
|
|
40
|
+
assert "expected a missing path to return blank"
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
parse_into_objects [test] :
|
|
43
|
+
description [string] : parse builds an object tree from the JSON.
|
|
44
|
+
on_test [script] :
|
|
45
|
+
tell ^^.payload to parse ( tests.objs.json.out )
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
eval tests.objs.json.out.title = 'Brute Force'
|
|
48
|
+
assert "expected parse to set the title"
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
eval tests.objs.json.out.meta.author = 'ESR'
|
|
51
|
+
assert "expected parse to build the nested meta container"
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
set_from_objects_round_trip [test] :
|
|
54
|
+
description [string] : set serialises an object tree; get reads it back.
|
|
55
|
+
on_test [script] :
|
|
56
|
+
# a path inside ( ) params must be absolute, not a ^ ref
|
|
57
|
+
tell ^^.built to set ( tests.objs.json.source )
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
tell ^^.built to get ( 'name' )
|
|
60
|
+
eval it = 'gloo'
|
|
61
|
+
assert "expected set then get to round-trip a value"
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
pretty_keeps_it_valid [test] :
|
|
64
|
+
description [string] : pretty reformats the text without breaking it.
|
|
65
|
+
on_test [script] :
|
|
66
|
+
tell ^^.compact to pretty
|
|
67
|
+
tell ^^.compact to get ( 'b.c' )
|
|
68
|
+
eval it = '2'
|
|
69
|
+
assert "expected the value to still be reachable after pretty"
|
|
70
|
+
|
|
71
|
+
assign_a_json_string_at_run_time [test] :
|
|
72
|
+
description [string] : a quote-containing literal can be put into an object at run time.
|
|
73
|
+
on_test [script] :
|
|
74
|
+
put '{"lang":"gloo","ok":true}' into tests.objs.json.assigned
|
|
75
|
+
tell ^^.assigned to get ( 'lang' )
|
|
76
|
+
eval it = 'gloo'
|
|
77
|
+
assert "expected the run-time JSON string to be assigned and readable"
|
|
@@ -2,51 +2,71 @@
|
|
|
2
2
|
# Root 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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
5
|
+
tests.objs.obj [can] :
|
|
6
|
+
|
|
7
|
+
o [any] :
|
|
8
|
+
a [can] :
|
|
9
|
+
b [string] : "b"
|
|
10
|
+
c [string] : "c"
|
|
11
|
+
d [string] : "d"
|
|
12
|
+
|
|
13
|
+
# A documented string, used to check the doc message.
|
|
14
|
+
documented [string] : "value"
|
|
15
|
+
|
|
16
|
+
no_doc [string] : "value"
|
|
17
|
+
|
|
18
|
+
obj_contains [test] :
|
|
19
|
+
description [string] : Check to see if an object contains children
|
|
20
|
+
on_test [script] :
|
|
21
|
+
check tests.objs.obj.o for contains?
|
|
22
|
+
refute "the object does not contain children"
|
|
23
|
+
|
|
24
|
+
check tests.objs.obj.a for contains?
|
|
25
|
+
assert "the object contains children"
|
|
26
|
+
|
|
27
|
+
blank_object [test] :
|
|
28
|
+
description [string] : Check for a blank string
|
|
29
|
+
on_test [script] :
|
|
30
|
+
check tests.objs.obj.a.b for blank?
|
|
31
|
+
refute "the string should be blank"
|
|
32
|
+
|
|
33
|
+
check tests.objs.obj.o for blank?
|
|
34
|
+
assert "the object should be blank"
|
|
35
|
+
|
|
36
|
+
responds_to_blank [test] :
|
|
37
|
+
description [string] : Verify that all objects respond to blank? msessage
|
|
38
|
+
on_test [script] :
|
|
39
|
+
check tests.objs.obj.o for responds_to? ('blank?')
|
|
40
|
+
assert "expected any object to respond to blank?"
|
|
41
|
+
|
|
42
|
+
responds_to_contains [test] :
|
|
43
|
+
description [string] : Verify that all objects respond to contains? msessage
|
|
44
|
+
on_test [script] :
|
|
45
|
+
check tests.objs.obj.o for responds_to? ('contains?')
|
|
46
|
+
assert "expected any object to respond to contains?"
|
|
47
|
+
|
|
48
|
+
responds_to_up [test] :
|
|
49
|
+
description [string] : Verify that strings respond to up msessage
|
|
50
|
+
on_test [script] :
|
|
51
|
+
check tests.objs.obj.o for responds_to? ('up')
|
|
52
|
+
refute "expected any object to not respond to up"
|
|
53
|
+
|
|
54
|
+
check tests.objs.obj.a.b for responds_to? ('up')
|
|
55
|
+
assert "expected string to respond to up"
|
|
56
|
+
|
|
57
|
+
responds_to_doc [test] :
|
|
58
|
+
description [string] : Verify that all objects respond to doc message
|
|
59
|
+
on_test [script] :
|
|
60
|
+
check tests.objs.obj.o for responds_to? ('doc')
|
|
61
|
+
assert "expected any object to respond to doc"
|
|
62
|
+
|
|
63
|
+
doc_message [test] :
|
|
64
|
+
description [string] : doc returns the object's leading comment, cleaned up.
|
|
65
|
+
on_test [script] :
|
|
66
|
+
check tests.objs.obj.documented for doc
|
|
67
|
+
eval it = "A documented string, used to check the doc message."
|
|
68
|
+
assert "expected doc to return the cleaned leading comment"
|
|
69
|
+
|
|
70
|
+
check tests.objs.obj.no_doc for doc
|
|
71
|
+
eval it = ""
|
|
72
|
+
assert "expected doc to be blank for an object with no leading comment"
|
|
@@ -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"
|