lizarb 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -13
- data/Rakefile +38 -0
- data/app/dev_box.rb +26 -4
- data/app/happy_box.rb +2 -2
- data/app/net/databases/sqlite_db_test.rb +5 -5
- data/app/net/records/app_record_test.rb +1 -1
- data/app/net/records/post_record_test.rb +1 -1
- data/app/net/records/user_record_test.rb +1 -1
- data/app/net_box.rb +9 -9
- data/app/web_box.rb +4 -4
- data/app.rb +6 -7
- data/{exe/Gemfile → app_global.gemfile.rb} +2 -0
- data/app_global.gemfile.rb.lock +19 -0
- data/app_global.rb +4 -0
- data/{app → app_new}/dev/benches/loops_bench.rb +3 -2
- data/{app/dev/generators/bench_generator_test.rb → app_new/dev/benches/loops_bench_test.rb} +2 -2
- data/app_new/dev/benches/objects_bench.rb +83 -0
- data/{app/dev/generators/record_generator_test.rb → app_new/dev/benches/objects_bench_test.rb} +2 -2
- data/app_new/dev/benches/sorted_bench.rb +54 -0
- data/app_new/dev/benches/sorted_bench_test.rb +12 -0
- data/app_new/dev/benches/variables_bench.rb +55 -0
- data/{app/dev/generators/command_generator_test.rb → app_new/dev/benches/variables_bench_test.rb} +2 -2
- data/{app → app_new}/dev/commands/calculator_command.rb +1 -1
- data/{app → app_new}/dev/commands/circle_command.rb +1 -1
- data/{app → app_new}/dev/commands/narrative_method_command.rb +5 -7
- data/{app → app_new}/dev/commands/quadratic_command.rb +1 -1
- data/app_new/dev_box.rb +14 -0
- data/app_new.rb +15 -0
- data/exe/lizarb +9 -1
- data/lib/app.rb +27 -95
- data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +23 -18
- data/lib/dev_system/dev/controllers/bench/not_found_bench_test.rb +9 -11
- data/lib/dev_system/dev/controllers/bench.rb +1 -9
- data/lib/dev_system/dev/controllers/bench_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/bench_command.rb +19 -22
- data/lib/dev_system/dev/controllers/command/bench_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/generate_command.rb +5 -31
- data/lib/dev_system/dev/controllers/command/generate_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/new_command.rb +9 -0
- data/lib/dev_system/dev/controllers/command/new_command_test.rb +7 -0
- data/lib/dev_system/dev/controllers/command/not_found_command.rb +37 -18
- data/lib/dev_system/dev/controllers/command/not_found_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/terminal_command.rb +12 -14
- data/lib/dev_system/dev/controllers/command/terminal_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/test_command.rb +64 -53
- data/lib/dev_system/dev/controllers/command/test_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command.rb +9 -15
- data/lib/dev_system/dev/controllers/command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generator.rb +5 -7
- data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +33 -37
- data/lib/dev_system/dev/controllers/generator_test.rb +8 -10
- data/{app/dev/generators/bench_generator/bench.rb.erb → lib/dev_system/dev/controllers/generators/bench_generator/controller.rb.erb} +1 -2
- data/{app/dev/generators/bench_generator/bench_test.rb.erb → lib/dev_system/dev/controllers/generators/bench_generator/controller_test.rb.erb} +2 -2
- data/lib/dev_system/dev/controllers/generators/bench_generator.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/bench_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/command_generator/controller.rb.erb +41 -0
- data/{app/dev/generators/command_generator/command_test.rb.erb → lib/dev_system/dev/controllers/generators/command_generator/controller_test.rb.erb} +2 -2
- data/lib/dev_system/dev/controllers/generators/command_generator.rb +19 -0
- data/lib/dev_system/dev/controllers/generators/command_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/controller_generator.rb +97 -0
- data/lib/dev_system/dev/controllers/generators/controller_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/generator_generator/template.rb.erb +1 -1
- data/lib/dev_system/dev/controllers/generators/new_generator.rb +117 -0
- data/lib/dev_system/dev/controllers/generators/new_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +27 -17
- data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +8 -10
- data/{app/dev → lib/dev_system/dev/controllers}/generators/record_generator.rb +1 -1
- data/lib/dev_system/dev/controllers/generators/record_generator_test.rb +12 -0
- data/{app/dev → lib/dev_system/dev/controllers}/generators/request_generator.rb +2 -2
- data/lib/dev_system/dev/controllers/generators/request_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/log.rb +3 -0
- data/{app/dev/generators/request_generator_test.rb → lib/dev_system/dev/controllers/log_test.rb} +2 -2
- data/lib/dev_system/dev/controllers/shell.rb +22 -0
- data/lib/dev_system/dev/controllers/shell_test.rb +25 -0
- data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +15 -11
- data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +8 -10
- data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +6 -8
- data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +8 -10
- data/lib/dev_system/dev/controllers/terminal.rb +11 -13
- data/lib/dev_system/dev/controllers/terminal_test.rb +8 -10
- data/lib/dev_system/dev/dev_box.rb +27 -16
- data/lib/dev_system/dev/dev_box_test.rb +12 -14
- data/lib/dev_system/dev/panels/bench_panel.rb +3 -0
- data/lib/dev_system/dev/panels/bench_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/command_panel.rb +59 -18
- data/lib/dev_system/dev/panels/command_panel_test.rb +43 -20
- data/lib/dev_system/dev/panels/generator_panel.rb +73 -0
- data/lib/dev_system/dev/panels/generator_panel_test.rb +46 -0
- data/lib/dev_system/dev/panels/log_panel.rb +9 -6
- data/lib/dev_system/dev/panels/log_panel_test.rb +11 -13
- data/lib/dev_system/dev/panels/shell_panel.rb +3 -0
- data/lib/dev_system/dev/panels/shell_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/terminal_panel.rb +3 -0
- data/lib/dev_system/dev/panels/terminal_panel_test.rb +12 -0
- data/lib/happy_system/happy/controllers/axo.rb +4 -5
- data/lib/happy_system/happy/happy_box.rb +5 -9
- data/lib/happy_system/happy/happy_box_test.rb +11 -13
- data/lib/happy_system/happy/panels/axo_panel.rb +1 -3
- data/lib/lerb.rb +95 -49
- data/lib/liza/base/box.rb +76 -26
- data/lib/liza/base/box_test.rb +7 -9
- data/lib/liza/base/controller.rb +19 -21
- data/lib/liza/base/controller_test.rb +7 -9
- data/lib/liza/base/panel.rb +40 -27
- data/lib/liza/base/panel_test.rb +36 -12
- data/lib/liza/base_parts/controller_renderer_part.rb +1 -1
- data/lib/liza/meta/part.rb +12 -14
- data/lib/liza/meta/part_extension.rb +14 -16
- data/lib/liza/meta/part_test.rb +4 -6
- data/lib/liza/meta/system.rb +12 -14
- data/lib/liza/meta/system_test.rb +8 -10
- data/lib/liza/ruby_test.rb +4 -6
- data/lib/liza/ruby_tests/module_test.rb +3 -3
- data/lib/liza/test/test.rb +7 -10
- data/lib/liza/test/test_test.rb +160 -157
- data/lib/liza/test_parts/test_assertions_advanced_part.rb +102 -104
- data/lib/liza/test_parts/test_assertions_part.rb +81 -83
- data/lib/liza/test_parts/test_dsl_part.rb +47 -49
- data/lib/liza/test_parts/test_log_part.rb +88 -90
- data/lib/liza/test_parts/test_subject_part.rb +16 -18
- data/lib/liza/test_parts/test_tree_part.rb +73 -120
- data/lib/liza/unit.rb +105 -107
- data/lib/liza/unit_parts/unit_procedure_part_test.rb +9 -9
- data/lib/liza/unit_parts/unit_settings_part.rb +76 -0
- data/lib/liza/unit_parts/unit_settings_part_test.rb +3 -0
- data/lib/liza/unit_test.rb +80 -71
- data/lib/liza.rb +10 -1
- data/lib/lizarb/ruby/module.rb +1 -1
- data/lib/lizarb/version.rb +1 -1
- data/lib/lizarb.rb +247 -23
- data/lib/net_system/dev/net_command.rb +15 -17
- data/lib/net_system/net/controllers/client/redis_client.rb +19 -21
- data/lib/net_system/net/controllers/client/redis_client_test.rb +20 -22
- data/lib/net_system/net/controllers/client/sqlite_client.rb +19 -21
- data/lib/net_system/net/controllers/client/sqlite_client_test.rb +20 -22
- data/lib/net_system/net/controllers/client.rb +1 -3
- data/lib/net_system/net/controllers/client_test.rb +8 -10
- data/lib/net_system/net/controllers/database/redis_db.rb +6 -8
- data/lib/net_system/net/controllers/database/redis_db_test.rb +15 -17
- data/lib/net_system/net/controllers/database/sqlite_db.rb +6 -8
- data/lib/net_system/net/controllers/database/sqlite_db_test.rb +15 -17
- data/lib/net_system/net/controllers/database.rb +21 -23
- data/lib/net_system/net/controllers/database_test.rb +8 -10
- data/lib/net_system/net/controllers/record.rb +21 -23
- data/lib/net_system/net/controllers/record_test.rb +8 -10
- data/lib/net_system/net/net_box.rb +9 -16
- data/lib/net_system/net/net_box_test.rb +12 -14
- data/lib/net_system/net/panels/client_panel.rb +1 -3
- data/lib/net_system/net/panels/client_panel_test.rb +11 -13
- data/lib/net_system/net/panels/database_panel.rb +6 -8
- data/lib/net_system/net/panels/database_panel_test.rb +11 -13
- data/lib/web_system/dev/rack_command.rb +20 -18
- data/lib/web_system/dev/request_command.rb +8 -22
- data/lib/web_system/dev/web_command.rb +6 -8
- data/lib/web_system/web/controllers/rack.rb +4 -6
- data/lib/web_system/web/controllers/rack_test.rb +11 -13
- data/lib/web_system/web/controllers/request/client_error_request.rb +9 -11
- data/lib/web_system/web/controllers/request/not_found_request.rb +9 -11
- data/lib/web_system/web/controllers/request/server_error_request.rb +10 -12
- data/lib/web_system/web/controllers/request.rb +1 -3
- data/lib/web_system/web/controllers/request_test.rb +11 -13
- data/lib/web_system/web/panels/rack_panel.rb +37 -39
- data/lib/web_system/web/panels/rack_panel_test.rb +8 -10
- data/lib/web_system/web/panels/request_panel.rb +53 -57
- data/lib/web_system/web/panels/request_panel_test.rb +1 -1
- data/lib/web_system/web/web_box.rb +12 -18
- data/lib/web_system/web/web_box_test.rb +11 -13
- data/lizarb.gemspec +1 -1
- metadata +54 -44
- data/.ruby-version +0 -1
- data/app/dev/benches/app_bench.rb +0 -5
- data/app/dev/benches/app_bench_test.rb +0 -7
- data/app/dev/benches/loops_bench_test.rb +0 -11
- data/app/dev/commands/app_command.rb +0 -5
- data/app/dev/commands/app_command_test.rb +0 -7
- data/app/dev/commands/new_command.rb +0 -9
- data/app/dev/commands/new_command_test.rb +0 -7
- data/app/dev/generators/bench_generator.rb +0 -18
- data/app/dev/generators/command_generator/command.rb.erb +0 -26
- data/app/dev/generators/command_generator.rb +0 -18
- data/app_new/.gitignore +0 -4
- data/app_new/Gemfile +0 -31
- data/app_new/Procfile +0 -3
- data/exe/Gemfile.lock +0 -13
- data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +0 -60
- data/lib/dev_system/dev/controllers/command/echo_command.rb +0 -11
- data/lib/dev_system/dev/controllers/command/echo_command_test.rb +0 -14
- data/lib/dev_system/dev/controllers/command/version_command.rb +0 -9
- data/lib/dev_system/dev/controllers/command/version_command_test.rb +0 -14
- data/lib/dev_system/dev/controllers/generators/app_generator.rb +0 -96
- data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +0 -14
- /data/{app → app_new}/dev/commands/calculator_command_test.rb +0 -0
- /data/{app → app_new}/dev/commands/circle_command_test.rb +0 -0
- /data/{app → app_new}/dev/commands/narrative_method_command_test.rb +0 -0
- /data/{app → app_new}/dev/commands/quadratic_command_test.rb +0 -0
data/lib/liza/test/test_test.rb
CHANGED
@@ -1,201 +1,204 @@
|
|
1
|
-
module Liza
|
2
|
-
class TestTest < Test
|
3
1
|
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
class Liza::TestTest < Liza::Test
|
3
|
+
|
4
|
+
test :settings do
|
5
|
+
assert subject_class.log_level == :normal
|
6
|
+
assert subject_class.log_color == :white
|
7
|
+
end
|
8
|
+
|
9
|
+
group :basics do
|
10
|
+
test :truths do
|
11
|
+
assert true
|
12
|
+
assert true
|
13
|
+
assert true
|
7
14
|
end
|
8
15
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
16
|
+
test :falsehoods do
|
17
|
+
refute false
|
18
|
+
refute false
|
19
|
+
refute false
|
20
|
+
end
|
15
21
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
22
|
+
test :assertions do
|
23
|
+
assert assertions == 0
|
24
|
+
refute assertions != 1
|
25
|
+
assert assertions == 2
|
26
|
+
end
|
27
|
+
end
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
group :assertions do
|
30
|
+
test :assert do
|
31
|
+
assert 0
|
32
|
+
assert 1
|
33
|
+
assert :a
|
34
|
+
assert "a"
|
35
|
+
assert ""
|
36
|
+
assert []
|
37
|
+
assert [1]
|
38
|
+
assert({})
|
39
|
+
assert({a: 1})
|
40
|
+
assert true
|
41
|
+
refute false
|
42
|
+
refute nil
|
27
43
|
end
|
28
44
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
45
|
+
test :assert_equality do
|
46
|
+
assert_equality 0, 0
|
47
|
+
assert_equality 1, 1
|
48
|
+
assert_equality :a, :a
|
49
|
+
assert_equality "a", "a"
|
50
|
+
assert_equality "", ""
|
51
|
+
assert_equality [], []
|
52
|
+
assert_equality [1], [1]
|
53
|
+
assert_equality({}, {})
|
54
|
+
assert_equality({a: 1}, {a: 1})
|
55
|
+
assert_equality true, true
|
56
|
+
refute_equality false, true
|
57
|
+
refute_equality nil, true
|
58
|
+
end
|
59
|
+
|
60
|
+
test :assert_raises do
|
61
|
+
assert_raises StandardError do
|
62
|
+
raise RuntimeError
|
43
63
|
end
|
44
64
|
|
45
|
-
|
46
|
-
|
47
|
-
assert_equality 1, 1
|
48
|
-
assert_equality :a, :a
|
49
|
-
assert_equality "a", "a"
|
50
|
-
assert_equality "", ""
|
51
|
-
assert_equality [], []
|
52
|
-
assert_equality [1], [1]
|
53
|
-
assert_equality({}, {})
|
54
|
-
assert_equality({a: 1}, {a: 1})
|
55
|
-
assert_equality true, true
|
56
|
-
refute_equality false, true
|
57
|
-
refute_equality nil, true
|
65
|
+
assert_raises RuntimeError do
|
66
|
+
raise RuntimeError
|
58
67
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
raise RuntimeError
|
63
|
-
end
|
64
|
-
|
65
|
-
assert_raises RuntimeError do
|
66
|
-
raise RuntimeError
|
67
|
-
end
|
68
|
-
|
69
|
-
refute_raises RuntimeError do
|
70
|
-
raise StandardError
|
71
|
-
end
|
68
|
+
|
69
|
+
refute_raises RuntimeError do
|
70
|
+
raise StandardError
|
72
71
|
end
|
73
72
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
end
|
74
|
+
|
75
|
+
group :instance_variables do
|
76
|
+
test :instance_variables do
|
77
|
+
if Shell.jruby?
|
78
|
+
todo "jruby!"
|
79
|
+
else
|
77
80
|
assert_equality instance_variables, [:@test_words, :@before_stack, :@after_stack, :@test_block]
|
78
81
|
end
|
82
|
+
end
|
79
83
|
|
80
|
-
|
81
|
-
|
82
|
-
end
|
84
|
+
test :test_block do
|
85
|
+
assert_equality @test_block.source_location[1], __LINE__ - 1
|
83
86
|
end
|
87
|
+
end
|
84
88
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
group :tree do
|
90
|
+
test :test_tree do
|
91
|
+
assert_equality self.class.test_tree.class, Liza::TestTreePart::Extension
|
92
|
+
assert_equality self.class.test_tree, self.class.test_tree.parent
|
93
|
+
|
94
|
+
assert_equality 2, self.class.test_tree.tests.count
|
95
|
+
assert_equality 5, self.class.test_tree.children.count
|
92
96
|
|
93
|
-
|
94
|
-
end
|
97
|
+
assert_equality self.class.test_tree.tests.map(&:first).flatten, [:settings, :instance_groups]
|
95
98
|
end
|
99
|
+
end
|
96
100
|
|
97
|
-
|
98
|
-
|
101
|
+
test :instance_groups do
|
102
|
+
assert assertions == 0
|
99
103
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
104
|
+
group do
|
105
|
+
assert true
|
106
|
+
assert true
|
107
|
+
assert true
|
108
|
+
end
|
105
109
|
|
106
|
-
|
110
|
+
assert assertions == 2
|
107
111
|
|
112
|
+
group do
|
113
|
+
assert true
|
108
114
|
group do
|
109
115
|
assert true
|
110
|
-
group do
|
111
|
-
assert true
|
112
|
-
end
|
113
|
-
assert true
|
114
116
|
end
|
117
|
+
assert true
|
118
|
+
end
|
119
|
+
|
120
|
+
assert assertions == 4
|
121
|
+
end
|
115
122
|
|
116
|
-
|
123
|
+
group :class_groups do
|
124
|
+
before do
|
125
|
+
@string = "START"
|
126
|
+
assert_equality @string, "START"
|
117
127
|
end
|
118
128
|
|
119
|
-
|
129
|
+
test :class_groups, :outer_a do
|
130
|
+
@string.concat "-123"
|
131
|
+
assert_equality @string, "START-123"
|
132
|
+
#
|
133
|
+
@expectation_outer = "START-123-FINISH"
|
134
|
+
end
|
135
|
+
|
136
|
+
test :class_groups, :outer_b do
|
137
|
+
@string.concat "-321"
|
138
|
+
assert_equality @string, "START-321"
|
139
|
+
#
|
140
|
+
@expectation_outer = "START-321-FINISH"
|
141
|
+
end
|
142
|
+
|
143
|
+
group :class_groups_inner do
|
120
144
|
before do
|
121
|
-
@string
|
122
|
-
assert_equality @string, "START"
|
145
|
+
@string.concat "-BEGIN"
|
146
|
+
assert_equality @string, "START-BEGIN"
|
123
147
|
end
|
124
148
|
|
125
|
-
test :class_groups, :
|
126
|
-
@string.concat "-
|
127
|
-
assert_equality @string, "START-
|
149
|
+
test :class_groups, :inner_a do
|
150
|
+
@string.concat "-aaa"
|
151
|
+
assert_equality @string, "START-BEGIN-aaa"
|
128
152
|
#
|
129
|
-
@
|
153
|
+
@expectation_inner = "START-BEGIN-aaa-END"
|
154
|
+
@expectation_outer = "START-BEGIN-aaa-END-FINISH"
|
130
155
|
end
|
131
156
|
|
132
|
-
test :class_groups, :
|
133
|
-
@string.concat "-
|
134
|
-
assert_equality @string, "START-
|
157
|
+
test :class_groups, :inner_b do
|
158
|
+
@string.concat "-bbb"
|
159
|
+
assert_equality @string, "START-BEGIN-bbb"
|
135
160
|
#
|
136
|
-
@
|
137
|
-
|
138
|
-
|
139
|
-
group :class_groups_inner do
|
140
|
-
before do
|
141
|
-
@string.concat "-BEGIN"
|
142
|
-
assert_equality @string, "START-BEGIN"
|
143
|
-
end
|
144
|
-
|
145
|
-
test :class_groups, :inner_a do
|
146
|
-
@string.concat "-aaa"
|
147
|
-
assert_equality @string, "START-BEGIN-aaa"
|
148
|
-
#
|
149
|
-
@expectation_inner = "START-BEGIN-aaa-END"
|
150
|
-
@expectation_outer = "START-BEGIN-aaa-END-FINISH"
|
151
|
-
end
|
152
|
-
|
153
|
-
test :class_groups, :inner_b do
|
154
|
-
@string.concat "-bbb"
|
155
|
-
assert_equality @string, "START-BEGIN-bbb"
|
156
|
-
#
|
157
|
-
@expectation_inner = "START-BEGIN-bbb-END"
|
158
|
-
@expectation_outer = "START-BEGIN-bbb-END-FINISH"
|
159
|
-
end
|
160
|
-
|
161
|
-
after do
|
162
|
-
@string.concat "-END"
|
163
|
-
assert_equality @string, @expectation_inner
|
164
|
-
end
|
161
|
+
@expectation_inner = "START-BEGIN-bbb-END"
|
162
|
+
@expectation_outer = "START-BEGIN-bbb-END-FINISH"
|
165
163
|
end
|
166
164
|
|
167
165
|
after do
|
168
|
-
@string
|
169
|
-
assert_equality @string, @
|
166
|
+
@string.concat "-END"
|
167
|
+
assert_equality @string, @expectation_inner
|
170
168
|
end
|
171
169
|
end
|
172
170
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
# raise "it should not have reached this line"
|
178
|
-
# end
|
179
|
-
|
180
|
-
# group :throw_within_before do
|
181
|
-
# before do
|
182
|
-
# assert! false
|
183
|
-
# end
|
184
|
-
|
185
|
-
# test :that_will_not_run do
|
186
|
-
# raise "it should not have reached this line"
|
187
|
-
# end
|
188
|
-
# end
|
189
|
-
|
190
|
-
# group :throw_within_after do
|
191
|
-
# test :that_will_not_run do
|
192
|
-
# assert! false
|
193
|
-
# end
|
194
|
-
|
195
|
-
# after do
|
196
|
-
# raise "it should not have reached this line"
|
197
|
-
# end
|
198
|
-
# end
|
199
|
-
# end
|
171
|
+
after do
|
172
|
+
@string << "-FINISH"
|
173
|
+
assert_equality @string, @expectation_outer
|
174
|
+
end
|
200
175
|
end
|
176
|
+
|
177
|
+
# group :throwables do
|
178
|
+
# test :throw_within_test do
|
179
|
+
# assert! true
|
180
|
+
# assert! false
|
181
|
+
# raise "it should not have reached this line"
|
182
|
+
# end
|
183
|
+
|
184
|
+
# group :throw_within_before do
|
185
|
+
# before do
|
186
|
+
# assert! false
|
187
|
+
# end
|
188
|
+
|
189
|
+
# test :that_will_not_run do
|
190
|
+
# raise "it should not have reached this line"
|
191
|
+
# end
|
192
|
+
# end
|
193
|
+
|
194
|
+
# group :throw_within_after do
|
195
|
+
# test :that_will_not_run do
|
196
|
+
# assert! false
|
197
|
+
# end
|
198
|
+
|
199
|
+
# after do
|
200
|
+
# raise "it should not have reached this line"
|
201
|
+
# end
|
202
|
+
# end
|
203
|
+
# end
|
201
204
|
end
|
@@ -1,127 +1,125 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@last_result = :failed
|
14
|
-
end
|
15
|
-
|
16
|
-
kaller ||= caller
|
17
|
-
log_test_assertion __method__, kaller if _groups.empty?
|
18
|
-
|
19
|
-
if log_test_assertion_message?
|
20
|
-
msg ||= "#{__method__} #{a}, #{b} (== equality)"
|
21
|
-
log_test_assertion_message ret, msg
|
22
|
-
end
|
23
|
-
|
24
|
-
ret
|
1
|
+
class Liza::TestAssertionsAdvancedPart < Liza::Part
|
2
|
+
insertion do
|
3
|
+
|
4
|
+
def assert_equality a, b, msg = nil, kaller: nil
|
5
|
+
ret = a == b
|
6
|
+
|
7
|
+
if ret
|
8
|
+
self.class._assertion_passed
|
9
|
+
@last_result = :passed
|
10
|
+
else
|
11
|
+
self.class._assertion_failed msg
|
12
|
+
@last_result = :failed
|
25
13
|
end
|
26
14
|
|
27
|
-
|
28
|
-
|
15
|
+
kaller ||= caller
|
16
|
+
log_test_assertion __method__, kaller if _groups.empty?
|
29
17
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
18
|
+
if log_test_assertion_message?
|
19
|
+
msg ||= "#{__method__} #{a}, #{b} (== equality)"
|
20
|
+
log_test_assertion_message ret, msg
|
21
|
+
end
|
22
|
+
|
23
|
+
ret
|
24
|
+
end
|
37
25
|
|
38
|
-
|
39
|
-
|
26
|
+
def refute_equality a, b, msg = nil, kaller: nil
|
27
|
+
ret = a == b
|
40
28
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
29
|
+
if ret
|
30
|
+
self.class._assertion_failed msg
|
31
|
+
@last_result = :failed
|
32
|
+
else
|
33
|
+
self.class._assertion_passed
|
34
|
+
@last_result = :passed
|
35
|
+
end
|
36
|
+
|
37
|
+
kaller ||= caller
|
38
|
+
log_test_assertion __method__, kaller if _groups.empty?
|
45
39
|
|
46
|
-
|
40
|
+
if log_test_assertion_message?
|
41
|
+
msg ||= "#{__method__} #{a}, #{b} (== equality)"
|
42
|
+
log_test_assertion_message !ret, msg
|
47
43
|
end
|
48
44
|
|
49
|
-
|
50
|
-
|
45
|
+
ret
|
46
|
+
end
|
47
|
+
|
48
|
+
def assert_equality! a, b, msg = nil
|
49
|
+
critical assert_equality a, b, msg, kaller: caller
|
50
|
+
end
|
51
|
+
|
52
|
+
def refute_equality! a, b, msg = nil
|
53
|
+
critical refute_equality a, b, msg, kaller: caller
|
54
|
+
end
|
55
|
+
|
56
|
+
def assert_raises exception_klass, msg = nil, kaller: nil, &block
|
57
|
+
raise ArgumentError, "No block given" unless block_given?
|
58
|
+
|
59
|
+
ret = false
|
60
|
+
begin
|
61
|
+
yield
|
62
|
+
rescue => e
|
63
|
+
ret = exception_klass === e
|
64
|
+
error = e
|
51
65
|
end
|
52
66
|
|
53
|
-
|
54
|
-
|
67
|
+
if ret
|
68
|
+
self.class._assertion_passed
|
69
|
+
@last_result = :passed
|
70
|
+
else
|
71
|
+
self.class._assertion_failed msg
|
72
|
+
@last_result = :failed
|
55
73
|
end
|
56
74
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
rescue => e
|
64
|
-
ret = exception_klass === e
|
65
|
-
error = e
|
66
|
-
end
|
67
|
-
|
68
|
-
if ret
|
69
|
-
self.class._assertion_passed
|
70
|
-
@last_result = :passed
|
71
|
-
else
|
72
|
-
self.class._assertion_failed msg
|
73
|
-
@last_result = :failed
|
74
|
-
end
|
75
|
-
|
76
|
-
kaller ||= caller
|
77
|
-
log_test_assertion __method__, kaller if _groups.empty?
|
78
|
-
|
79
|
-
if log_test_assertion_message?
|
80
|
-
msg ||= "#{__method__} (#{exception_klass}) #{error.inspect}"
|
81
|
-
log_test_assertion_message ret, msg
|
82
|
-
end
|
83
|
-
|
84
|
-
ret
|
75
|
+
kaller ||= caller
|
76
|
+
log_test_assertion __method__, kaller if _groups.empty?
|
77
|
+
|
78
|
+
if log_test_assertion_message?
|
79
|
+
msg ||= "#{__method__} (#{exception_klass}) #{error.inspect}"
|
80
|
+
log_test_assertion_message ret, msg
|
85
81
|
end
|
86
82
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
self.class._assertion_failed msg
|
100
|
-
@last_result = :failed
|
101
|
-
else
|
102
|
-
self.class._assertion_passed
|
103
|
-
@last_result = :passed
|
104
|
-
end
|
105
|
-
|
106
|
-
kaller ||= caller
|
107
|
-
log_test_assertion __method__, kaller if _groups.empty?
|
108
|
-
|
109
|
-
if log_test_assertion_message?
|
110
|
-
msg ||= "#{__method__} (#{exception_klass}) #{error.inspect}"
|
111
|
-
log_test_assertion_message !ret, msg
|
112
|
-
end
|
113
|
-
|
114
|
-
ret
|
83
|
+
ret
|
84
|
+
end
|
85
|
+
|
86
|
+
def refute_raises exception_klass, msg = nil, kaller: nil, &block
|
87
|
+
raise ArgumentError, "No block given" unless block_given?
|
88
|
+
|
89
|
+
ret = false
|
90
|
+
begin
|
91
|
+
yield
|
92
|
+
rescue => e
|
93
|
+
ret = !exception_klass === e
|
94
|
+
error = e
|
115
95
|
end
|
116
96
|
|
117
|
-
|
118
|
-
|
97
|
+
if ret
|
98
|
+
self.class._assertion_failed msg
|
99
|
+
@last_result = :failed
|
100
|
+
else
|
101
|
+
self.class._assertion_passed
|
102
|
+
@last_result = :passed
|
119
103
|
end
|
120
104
|
|
121
|
-
|
122
|
-
|
105
|
+
kaller ||= caller
|
106
|
+
log_test_assertion __method__, kaller if _groups.empty?
|
107
|
+
|
108
|
+
if log_test_assertion_message?
|
109
|
+
msg ||= "#{__method__} (#{exception_klass}) #{error.inspect}"
|
110
|
+
log_test_assertion_message !ret, msg
|
123
111
|
end
|
124
112
|
|
113
|
+
ret
|
125
114
|
end
|
115
|
+
|
116
|
+
def assert_raises! e, msg = nil
|
117
|
+
critical assert_raises e, msg, kaller: caller
|
118
|
+
end
|
119
|
+
|
120
|
+
def refute_raises! e, msg = nil
|
121
|
+
critical refute_raises e, msg, kaller: caller
|
122
|
+
end
|
123
|
+
|
126
124
|
end
|
127
125
|
end
|