lizarb 0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -2
- data/Gemfile +21 -2
- data/Gemfile.lock +44 -0
- data/README.md +88 -12
- data/app/dev/commands/app_command.rb +5 -0
- data/app/dev/commands/app_command_test.rb +7 -0
- data/app/dev/commands/example_command.rb +57 -0
- data/app/dev/commands/example_command_test.rb +43 -0
- data/app/dev/commands/macro_child_command.rb +32 -0
- data/app/dev/commands/macro_child_command_test.rb +7 -0
- data/app/dev/commands/macro_parent_command.rb +70 -0
- data/app/dev/commands/macro_parent_command_test.rb +7 -0
- data/app/dev/commands/my_command.rb +7 -0
- data/app/dev/commands/my_command_test.rb +7 -0
- data/app/dev/commands/new_command.rb +69 -0
- data/app/dev/commands/new_command_test.rb +7 -0
- data/app/dev_box.rb +13 -0
- data/app/happy/axos/axo.rb +50 -0
- data/app/happy_box.rb +8 -0
- data/app/net/databases/redis_db.rb +5 -0
- data/app/net/databases/redis_db_test.rb +12 -0
- data/app/net/databases/sqlite_db.rb +11 -0
- data/app/net/databases/sqlite_db_test.rb +12 -0
- data/app/net/models/app_model.rb +20 -0
- data/app/net/models/app_model_test.rb +8 -0
- data/app/net/models/post_model.rb +4 -0
- data/app/net/models/post_model_test.rb +8 -0
- data/app/net/models/user_model.rb +4 -0
- data/app/net/models/user_model_test.rb +8 -0
- data/app/net_box.rb +21 -0
- data/app/web/requests/api_request.rb +61 -0
- data/app/web/requests/api_request_test.rb +31 -0
- data/app/web/requests/app_request.rb +5 -0
- data/app/web/requests/app_request_test.rb +7 -0
- data/app/web/requests/assets_request.rb +71 -0
- data/app/web/requests/assets_request_test.rb +33 -0
- data/app/web/requests/root_request.rb +55 -0
- data/app/web/requests/root_request_test.rb +31 -0
- data/app/web_box.rb +8 -0
- data/app.code.env +11 -0
- data/app.env +11 -0
- data/app.rb +17 -0
- data/app_new/.gitignore +4 -0
- data/app_new/Gemfile +31 -0
- data/app_new/Procfile +3 -0
- data/exe/Gemfile +3 -0
- data/exe/Gemfile.lock +13 -0
- data/exe/liza +3 -0
- data/exe/lizarb +11 -0
- data/lib/app.rb +200 -0
- data/lib/dev_system/dev/controllers/command/dev_command.rb +19 -0
- data/lib/dev_system/dev/controllers/command/dev_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/echo_command.rb +11 -0
- data/lib/dev_system/dev/controllers/command/echo_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/test_command.rb +70 -0
- data/lib/dev_system/dev/controllers/command/test_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/version_command.rb +9 -0
- data/lib/dev_system/dev/controllers/command/version_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command.rb +19 -0
- data/lib/dev_system/dev/controllers/command_test.rb +14 -0
- data/lib/dev_system/dev/dev_box.rb +19 -0
- data/lib/dev_system/dev/dev_box_test.rb +19 -0
- data/lib/dev_system/dev/panels/command_panel.rb +10 -0
- data/lib/dev_system/dev/panels/command_panel_test.rb +23 -0
- data/lib/dev_system/dev/panels/log_panel.rb +10 -0
- data/lib/dev_system/dev/panels/log_panel_test.rb +18 -0
- data/lib/dev_system.rb +8 -0
- data/lib/happy_system/dev/happy_command.rb +11 -0
- data/lib/happy_system/happy/controllers/axo.rb +8 -0
- data/lib/happy_system/happy/happy_box.rb +12 -0
- data/lib/happy_system/happy/happy_box_test.rb +18 -0
- data/lib/happy_system/happy/panels/axo_panel.rb +5 -0
- data/lib/{viral.rb → happy_system.rb} +7 -3
- data/lib/liza/base/box.rb +40 -0
- data/lib/liza/base/box_test.rb +12 -0
- data/lib/liza/base/controller.rb +27 -0
- data/lib/liza/base/controller_test.rb +12 -0
- data/lib/liza/base/panel.rb +38 -0
- data/lib/liza/base/panel_test.rb +16 -0
- data/lib/liza/meta/part.rb +19 -0
- data/lib/liza/meta/part_extension.rb +13 -0
- data/lib/liza/meta/part_test.rb +8 -0
- data/lib/liza/meta/system.rb +20 -0
- data/lib/liza/meta/system_test.rb +13 -0
- data/lib/liza/test/test.rb +11 -0
- data/lib/liza/test/test_test.rb +108 -0
- data/lib/liza/test_parts/test_assertions_part.rb +110 -0
- data/lib/liza/test_parts/test_context_part.rb +81 -0
- data/lib/liza/test_parts/test_dsl_part.rb +122 -0
- data/lib/liza/test_parts/test_subject_part.rb +19 -0
- data/lib/liza/unit.rb +149 -0
- data/lib/liza/unit_test.rb +79 -0
- data/lib/liza.rb +34 -0
- data/lib/lizarb/ruby/class.rb +15 -0
- data/lib/lizarb/ruby/string.rb +9 -0
- data/lib/lizarb/ruby/time.rb +9 -0
- data/lib/{viral → lizarb}/version.rb +2 -2
- data/lib/lizarb.rb +68 -0
- data/lib/net_system/dev/net_command.rb +24 -0
- data/lib/net_system/net/controllers/adapter/redis_adapter.rb +28 -0
- data/lib/net_system/net/controllers/adapter/redis_adapter_test.rb +29 -0
- data/lib/net_system/net/controllers/adapter/sqlite_adapter.rb +28 -0
- data/lib/net_system/net/controllers/adapter/sqlite_adapter_test.rb +29 -0
- data/lib/net_system/net/controllers/adapter.rb +5 -0
- data/lib/net_system/net/controllers/adapter_test.rb +14 -0
- data/lib/net_system/net/controllers/database/redis_db.rb +11 -0
- data/lib/net_system/net/controllers/database/redis_db_test.rb +23 -0
- data/lib/net_system/net/controllers/database/sqlite_db.rb +11 -0
- data/lib/net_system/net/controllers/database/sqlite_db_test.rb +23 -0
- data/lib/net_system/net/controllers/database.rb +33 -0
- data/lib/net_system/net/controllers/database_test.rb +14 -0
- data/lib/net_system/net/controllers/model.rb +31 -0
- data/lib/net_system/net/controllers/model_test.rb +14 -0
- data/lib/net_system/net/net_box.rb +20 -0
- data/lib/net_system/net/net_box_test.rb +19 -0
- data/lib/net_system/net/panels/adapter_panel.rb +5 -0
- data/lib/net_system/net/panels/adapter_panel_test.rb +18 -0
- data/lib/net_system/net/panels/database_panel.rb +12 -0
- data/lib/net_system/net/panels/database_panel_test.rb +18 -0
- data/lib/net_system.rb +3 -0
- data/lib/web_system/dev/web_command.rb +42 -0
- data/lib/web_system/web/controllers/request/client_error_request.rb +18 -0
- data/lib/web_system/web/controllers/request/not_found_request.rb +18 -0
- data/lib/web_system/web/controllers/request/server_error_request.rb +20 -0
- data/lib/web_system/web/controllers/request.rb +5 -0
- data/lib/web_system/web/controllers/request_test.rb +18 -0
- data/lib/web_system/web/panels/request_panel.rb +55 -0
- data/lib/web_system/web/panels/request_panel_test.rb +14 -0
- data/lib/web_system/web/web_box.rb +12 -0
- data/lib/web_system/web/web_box_test.rb +18 -0
- data/lib/web_system.rb +5 -0
- data/lizarb.gemspec +44 -0
- data/sig/{viral.rbs → lizarb.rbs} +1 -1
- data/web_files/favicon.ico +0 -0
- data/web_files/favicon.svg +948 -0
- metadata +190 -13
- data/viral.gemspec +0 -45
@@ -0,0 +1,38 @@
|
|
1
|
+
module Liza
|
2
|
+
class Panel < Unit
|
3
|
+
inherited_explicitly_sets_system
|
4
|
+
|
5
|
+
def self.on_connected box_klass
|
6
|
+
set :box, box_klass
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.box
|
10
|
+
get :box
|
11
|
+
end
|
12
|
+
|
13
|
+
def box
|
14
|
+
self.class.box
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize name
|
18
|
+
@name = name
|
19
|
+
end
|
20
|
+
|
21
|
+
def log string
|
22
|
+
source = box.to_s
|
23
|
+
|
24
|
+
x = source.size
|
25
|
+
|
26
|
+
source = source.bold.colorize log_color
|
27
|
+
|
28
|
+
y = source.size
|
29
|
+
|
30
|
+
source = "#{source}.#{@name}".ljust(LOG_JUST+y-x)
|
31
|
+
|
32
|
+
string = "#{source} #{string}"
|
33
|
+
|
34
|
+
super string
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Liza
|
2
|
+
class PanelTest < UnitTest
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == Liza::Panel
|
5
|
+
end
|
6
|
+
|
7
|
+
def subject
|
8
|
+
subject_class.new "name"
|
9
|
+
end
|
10
|
+
|
11
|
+
test :settings do
|
12
|
+
assert subject_class.log_level == :normal
|
13
|
+
assert subject_class.log_color == :white
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Liza
|
2
|
+
class Part < Unit
|
3
|
+
def self.insertion &block
|
4
|
+
if block_given?
|
5
|
+
@insertion = block
|
6
|
+
else
|
7
|
+
@insertion
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.extension &block
|
12
|
+
if block_given?
|
13
|
+
@extension = block
|
14
|
+
else
|
15
|
+
@extension
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Liza
|
2
|
+
class System < Unit
|
3
|
+
|
4
|
+
def self.const name
|
5
|
+
const_get name.to_s.camelize
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.insertion key, &block
|
9
|
+
if block_given?
|
10
|
+
registrar[:"insertion_#{key}"] = block
|
11
|
+
else
|
12
|
+
registrar[:"insertion_#{key}"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.registrar
|
17
|
+
@registrar ||= {}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Liza
|
2
|
+
class TestTest < 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
|
14
|
+
end
|
15
|
+
|
16
|
+
test :falsehoods do
|
17
|
+
refute false
|
18
|
+
refute false
|
19
|
+
refute false
|
20
|
+
end
|
21
|
+
|
22
|
+
test :assertions do
|
23
|
+
assert assertions == 0
|
24
|
+
refute assertions != 1
|
25
|
+
assert assertions == 2
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
test :instance_groups do
|
30
|
+
assert assertions == 0
|
31
|
+
|
32
|
+
group do
|
33
|
+
assert true
|
34
|
+
assert true
|
35
|
+
assert true
|
36
|
+
end
|
37
|
+
|
38
|
+
assert assertions == 2
|
39
|
+
|
40
|
+
group do
|
41
|
+
assert true
|
42
|
+
group do
|
43
|
+
assert true
|
44
|
+
end
|
45
|
+
assert true
|
46
|
+
end
|
47
|
+
|
48
|
+
assert assertions == 4
|
49
|
+
end
|
50
|
+
|
51
|
+
group do
|
52
|
+
before do
|
53
|
+
@a = true
|
54
|
+
assert @a
|
55
|
+
end
|
56
|
+
|
57
|
+
group do
|
58
|
+
before do
|
59
|
+
refute @b
|
60
|
+
@b = true
|
61
|
+
end
|
62
|
+
|
63
|
+
test :Test, :inner do
|
64
|
+
assert @a
|
65
|
+
assert @b
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
test :Test, :outer do
|
70
|
+
assert @a
|
71
|
+
refute @b
|
72
|
+
end
|
73
|
+
|
74
|
+
after do
|
75
|
+
assert @a
|
76
|
+
refute @b
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# group :throwables do
|
81
|
+
# test :throw_within_test do
|
82
|
+
# assert! true
|
83
|
+
# assert! false
|
84
|
+
# raise "it should not have reached this line"
|
85
|
+
# end
|
86
|
+
|
87
|
+
# group :throw_within_before do
|
88
|
+
# before do
|
89
|
+
# assert! false
|
90
|
+
# end
|
91
|
+
|
92
|
+
# test :that_will_not_run do
|
93
|
+
# raise "it should not have reached this line"
|
94
|
+
# end
|
95
|
+
# end
|
96
|
+
|
97
|
+
# group :throw_within_after do
|
98
|
+
# test :that_will_not_run do
|
99
|
+
# assert! false
|
100
|
+
# end
|
101
|
+
|
102
|
+
# after do
|
103
|
+
# raise "it should not have reached this line"
|
104
|
+
# end
|
105
|
+
# end
|
106
|
+
# end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
module Liza
|
2
|
+
class TestAssertionsPart < Part
|
3
|
+
insertion do
|
4
|
+
# CLASS
|
5
|
+
|
6
|
+
def self.totals
|
7
|
+
@totals ||= {
|
8
|
+
todos: [],
|
9
|
+
passes: [],
|
10
|
+
fails: [],
|
11
|
+
errors: [],
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def self._assertion_todo msg
|
16
|
+
self.totals[:todos] << msg
|
17
|
+
end
|
18
|
+
|
19
|
+
def self._assertion_passed
|
20
|
+
self.totals[:passes] << 1
|
21
|
+
end
|
22
|
+
|
23
|
+
def self._assertion_failed msg
|
24
|
+
self.totals[:fails] << msg
|
25
|
+
end
|
26
|
+
|
27
|
+
def self._assertion_errored e
|
28
|
+
self.totals[:errors] << e
|
29
|
+
end
|
30
|
+
|
31
|
+
# INSTANCE
|
32
|
+
|
33
|
+
attr_writer :assertions
|
34
|
+
|
35
|
+
def assertions
|
36
|
+
@assertions ||= 0
|
37
|
+
end
|
38
|
+
|
39
|
+
def _inc_assertions
|
40
|
+
self.assertions += 1
|
41
|
+
end
|
42
|
+
|
43
|
+
# ASSERTIONS
|
44
|
+
|
45
|
+
def todo msg
|
46
|
+
self.class._assertion_todo msg
|
47
|
+
@last_result = :todo
|
48
|
+
|
49
|
+
_assertion_log __method__, caller if _groups.empty?
|
50
|
+
end
|
51
|
+
|
52
|
+
def _groups
|
53
|
+
@_groups ||= []
|
54
|
+
end
|
55
|
+
|
56
|
+
def group kaller: nil, **_words, &block
|
57
|
+
block_given? || raise(ArgumentError, "No block given")
|
58
|
+
|
59
|
+
_groups << block
|
60
|
+
instance_exec &block
|
61
|
+
_groups.pop
|
62
|
+
|
63
|
+
kaller ||= caller
|
64
|
+
_assertion_log __method__, kaller if _groups.empty?
|
65
|
+
end
|
66
|
+
|
67
|
+
def assert b, msg = "it should have been true", kaller: nil
|
68
|
+
if b
|
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
|
+
_assertion_log __method__, kaller if _groups.empty?
|
78
|
+
|
79
|
+
b
|
80
|
+
end
|
81
|
+
|
82
|
+
def refute b, msg = "it should have been false", kaller: nil
|
83
|
+
if b
|
84
|
+
self.class._assertion_failed msg
|
85
|
+
@last_result = :failed
|
86
|
+
else
|
87
|
+
self.class._assertion_passed
|
88
|
+
@last_result = :passed
|
89
|
+
end
|
90
|
+
|
91
|
+
kaller ||= caller
|
92
|
+
_assertion_log __method__, kaller if _groups.empty?
|
93
|
+
|
94
|
+
b
|
95
|
+
end
|
96
|
+
|
97
|
+
def assert! b, msg = "it should have been true"
|
98
|
+
critical assert b, msg, kaller: caller
|
99
|
+
end
|
100
|
+
|
101
|
+
def refute! b, msg = "it should have been false"
|
102
|
+
critical refute b, msg, kaller: caller
|
103
|
+
end
|
104
|
+
|
105
|
+
def critical passed
|
106
|
+
throw :critical, :critical if not passed
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Liza
|
2
|
+
class TestContextPart < Part
|
3
|
+
|
4
|
+
insertion do
|
5
|
+
def self.context
|
6
|
+
@context ||= Liza::TestContextPart::Extension.new self
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.before &block
|
10
|
+
block_given? || raise(ArgumentError, "No block given")
|
11
|
+
|
12
|
+
context.add_before block
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.after &block
|
16
|
+
block_given? || raise(ArgumentError, "No block given")
|
17
|
+
|
18
|
+
context.add_after block
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.group *_words, &block
|
22
|
+
block_given? || raise(ArgumentError, "No block given")
|
23
|
+
|
24
|
+
context.open_group
|
25
|
+
instance_exec &block
|
26
|
+
context.close_group
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
extension do
|
31
|
+
# group
|
32
|
+
|
33
|
+
def open_group
|
34
|
+
befores.push befores.last.dup
|
35
|
+
afters.push afters.last.dup
|
36
|
+
end
|
37
|
+
|
38
|
+
def close_group
|
39
|
+
befores.pop
|
40
|
+
afters.pop
|
41
|
+
end
|
42
|
+
|
43
|
+
# before
|
44
|
+
|
45
|
+
def befores
|
46
|
+
@befores ||= _befores_from_superclass + [[]]
|
47
|
+
end
|
48
|
+
|
49
|
+
def add_before block
|
50
|
+
befores.last.push block
|
51
|
+
end
|
52
|
+
|
53
|
+
def _befores_from_superclass
|
54
|
+
if solder.superclass.respond_to? :context
|
55
|
+
solder.superclass.context.befores.dup
|
56
|
+
else
|
57
|
+
[]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# after
|
62
|
+
|
63
|
+
def afters
|
64
|
+
@afters ||= _afters_from_superclass + [[]]
|
65
|
+
end
|
66
|
+
|
67
|
+
def add_after block
|
68
|
+
afters.last.push block
|
69
|
+
end
|
70
|
+
|
71
|
+
def _afters_from_superclass
|
72
|
+
if solder.superclass.respond_to? :context
|
73
|
+
solder.superclass.context.afters.dup
|
74
|
+
else
|
75
|
+
[]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
module Liza
|
2
|
+
class TestDslPart < Part
|
3
|
+
insertion do
|
4
|
+
def self.test *words, &block
|
5
|
+
Liza.log "#{inspect}.test #{words}, &block"
|
6
|
+
block_given? || raise(ArgumentError, "No block given")
|
7
|
+
|
8
|
+
key = [
|
9
|
+
block.source_location,
|
10
|
+
'b',
|
11
|
+
context.befores.flatten.map(&:source_location),
|
12
|
+
'a',
|
13
|
+
context.afters.flatten.map(&:source_location),
|
14
|
+
].flatten.join("-")
|
15
|
+
|
16
|
+
key.gsub! Lizarb::CUR_DIR, ""
|
17
|
+
|
18
|
+
instances[key] ||= new words,
|
19
|
+
context.befores.flatten.uniq,
|
20
|
+
context.afters.flatten.uniq,
|
21
|
+
&block
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.instances
|
25
|
+
@instances ||= {}
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.call class_index, class_count
|
29
|
+
counter_class = "#{class_index.to_s.rjust 3, "0"}/#{class_count.to_s.rjust 3, "0"}"
|
30
|
+
|
31
|
+
puts "- #{counter_class} #{self} (#{instances.size} tests)".cyan
|
32
|
+
|
33
|
+
instances.values.each_with_index do |instance, i|
|
34
|
+
counter_instance = "#{(i+=1).to_s.rjust 2, '0'}/#{instances.size.to_s.rjust 2, '0'}"
|
35
|
+
label = instance.words_as_label
|
36
|
+
|
37
|
+
puts " #{ counter_class } #{ counter_instance } (#{ label })".light_cyan
|
38
|
+
|
39
|
+
instance.call
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
|
45
|
+
attr_reader :words
|
46
|
+
|
47
|
+
def initialize words, befores, afters, &block
|
48
|
+
@words, @befores, @afters, @block = words, befores, afters, block
|
49
|
+
end
|
50
|
+
|
51
|
+
def call
|
52
|
+
catch :critical do
|
53
|
+
@befores.each do |bl|
|
54
|
+
_call_log "B&", &bl
|
55
|
+
instance_exec &bl
|
56
|
+
end
|
57
|
+
|
58
|
+
bl = @block
|
59
|
+
_call_log " &", &bl
|
60
|
+
instance_exec &bl
|
61
|
+
|
62
|
+
@afters.each do |bl|
|
63
|
+
_call_log "A&", &bl
|
64
|
+
instance_exec &bl
|
65
|
+
end
|
66
|
+
end
|
67
|
+
rescue Exception => e
|
68
|
+
self.class._assertion_errored e
|
69
|
+
_rescue_log e
|
70
|
+
ensure
|
71
|
+
puts
|
72
|
+
end
|
73
|
+
|
74
|
+
def words_as_label
|
75
|
+
label = words.to_s
|
76
|
+
label = label[1..-2] if label.start_with? "["
|
77
|
+
label = label[1..-2] if label.start_with? "{"
|
78
|
+
label
|
79
|
+
end
|
80
|
+
|
81
|
+
def _rescue_log e
|
82
|
+
prefix = "error"
|
83
|
+
|
84
|
+
kaller = e.backtrace
|
85
|
+
|
86
|
+
source_location = _caller_line_split(kaller[0])[0]
|
87
|
+
source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
|
88
|
+
|
89
|
+
log " #{prefix} #{source_location}"
|
90
|
+
|
91
|
+
puts "Exception!".red
|
92
|
+
puts e.class.to_s.red
|
93
|
+
puts e.message.red
|
94
|
+
puts
|
95
|
+
puts e.backtrace.join("\n").red
|
96
|
+
end
|
97
|
+
|
98
|
+
def _call_log prefix, &block
|
99
|
+
source_location = block.source_location.join(":").gsub("#{Lizarb::CUR_DIR}/", "")
|
100
|
+
source_location = source_location[0..-1]
|
101
|
+
log " #{prefix} #{source_location}"
|
102
|
+
end
|
103
|
+
|
104
|
+
def _assertion_log method_name, kaller
|
105
|
+
_inc_assertions
|
106
|
+
method_name = method_name.to_s.ljust 6
|
107
|
+
prefix = "#{assertions} #{method_name} #{@last_result}"
|
108
|
+
|
109
|
+
source_location = _caller_line_split(kaller[0])[0]
|
110
|
+
source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
|
111
|
+
|
112
|
+
log " #{prefix} #{source_location}"
|
113
|
+
end
|
114
|
+
|
115
|
+
def _caller_line_split s
|
116
|
+
x = s.split ":in `"
|
117
|
+
x[1] = x[1][0..-2]
|
118
|
+
x
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Liza
|
2
|
+
class TestSubjectPart < Part
|
3
|
+
|
4
|
+
insertion do
|
5
|
+
def self.subject_class
|
6
|
+
@subject_class ||= Liza::const name[0..-5]
|
7
|
+
end
|
8
|
+
|
9
|
+
def subject_class
|
10
|
+
self.class.subject_class
|
11
|
+
end
|
12
|
+
|
13
|
+
def subject
|
14
|
+
@subject ||= subject_class.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|