vedeu 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/docs/dsl.md +4 -4
- data/lib/vedeu/all.rb +6 -18
- data/lib/vedeu/api.rb +14 -13
- data/lib/vedeu/bindings/system.rb +5 -4
- data/lib/vedeu/buffers/virtual_buffer.rb +13 -11
- data/lib/vedeu/configuration/api.rb +4 -3
- data/lib/vedeu/cursors/cursor.rb +23 -18
- data/lib/vedeu/distributed/client.rb +11 -6
- data/lib/vedeu/distributed/server.rb +4 -3
- data/lib/vedeu/dsl/keymap.rb +6 -6
- data/lib/vedeu/editor/all.rb +19 -0
- data/lib/vedeu/{input/editor → editor}/capture.rb +1 -1
- data/lib/vedeu/{input/editor → editor}/cropper.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/cursor.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/document.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/documents.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/editor.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/insert.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/line.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/lines.rb +0 -0
- data/lib/vedeu/error.rb +21 -18
- data/lib/vedeu/esc/borders.rb +6 -4
- data/lib/vedeu/esc/colours.rb +13 -12
- data/lib/vedeu/esc/esc.rb +11 -10
- data/lib/vedeu/input/all.rb +15 -0
- data/lib/vedeu/input/input.rb +55 -52
- data/lib/vedeu/input/key.rb +36 -30
- data/lib/vedeu/input/keymap.rb +101 -92
- data/lib/vedeu/input/keymaps.rb +10 -6
- data/lib/vedeu/input/keys.rb +8 -4
- data/lib/vedeu/input/mapper.rb +125 -121
- data/lib/vedeu/input/translator.rb +159 -0
- data/lib/vedeu/internal_api.rb +16 -15
- data/lib/vedeu/logging/all.rb +13 -0
- data/lib/vedeu/logging/debug.rb +84 -0
- data/lib/vedeu/logging/lockless_log_device.rb +65 -0
- data/lib/vedeu/logging/log.rb +179 -0
- data/lib/vedeu/logging/mono_logger.rb +26 -0
- data/lib/vedeu/logging/timer.rb +68 -0
- data/lib/vedeu/menus/all.rb +12 -0
- data/lib/vedeu/{dsl/menu.rb → menus/dsl.rb} +19 -18
- data/lib/vedeu/menus/menu.rb +234 -0
- data/lib/vedeu/{null/menu.rb → menus/null.rb} +6 -6
- data/lib/vedeu/menus/repository.rb +18 -0
- data/lib/vedeu/models/cell.rb +62 -55
- data/lib/vedeu/models/escape.rb +55 -50
- data/lib/vedeu/models/page.rb +74 -69
- data/lib/vedeu/models/row.rb +55 -51
- data/lib/vedeu/models/views/all.rb +1 -0
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/html_char.rb +165 -0
- data/lib/vedeu/output/renderers/html.rb +5 -4
- data/lib/vedeu/repositories/model.rb +2 -0
- data/lib/vedeu/runtime/application.rb +110 -103
- data/lib/vedeu/runtime/bootstrap.rb +109 -103
- data/lib/vedeu/runtime/flags.rb +45 -41
- data/lib/vedeu/runtime/launcher.rb +1 -1
- data/lib/vedeu/runtime/main_loop.rb +51 -46
- data/lib/vedeu/runtime/traps.rb +20 -16
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu.rb +2 -2
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +1 -1
- data/test/lib/vedeu/cursors/cursor_test.rb +11 -5
- data/test/lib/vedeu/dsl/interface_test.rb +1 -1
- data/test/lib/vedeu/dsl/keymap_test.rb +2 -2
- data/test/lib/vedeu/{input/editor → editor}/capture_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/cropper_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/cursor_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/document_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/documents_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/editor_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/insert_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/line_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/lines_test.rb +0 -0
- data/test/lib/vedeu/input/input_test.rb +58 -54
- data/test/lib/vedeu/input/key_test.rb +29 -25
- data/test/lib/vedeu/input/keymap_test.rb +74 -70
- data/test/lib/vedeu/input/keymaps_test.rb +8 -4
- data/test/lib/vedeu/input/keys_test.rb +12 -8
- data/test/lib/vedeu/input/mapper_test.rb +64 -56
- data/test/lib/vedeu/input/translator_test.rb +36 -0
- data/test/lib/vedeu/logging/debug_test.rb +39 -0
- data/test/lib/vedeu/logging/lockless_log_device_test.rb +42 -0
- data/test/lib/vedeu/logging/log_test.rb +52 -0
- data/test/lib/vedeu/logging/mono_logger_test.rb +43 -0
- data/test/lib/vedeu/logging/timer_test.rb +44 -0
- data/test/lib/vedeu/{dsl/menu_test.rb → menus/dsl_test.rb} +6 -6
- data/test/lib/vedeu/menus/menu_test.rb +305 -0
- data/test/lib/vedeu/{null/menu_test.rb → menus/null_test.rb} +5 -5
- data/test/lib/vedeu/menus/repository_test.rb +17 -0
- data/test/lib/vedeu/models/cell_test.rb +54 -50
- data/test/lib/vedeu/models/escape_test.rb +49 -45
- data/test/lib/vedeu/models/page_test.rb +167 -160
- data/test/lib/vedeu/models/row_test.rb +71 -67
- data/test/lib/vedeu/models/views/html_char_test.rb +110 -0
- data/test/lib/vedeu/output/compressor_test.rb +44 -22
- data/test/lib/vedeu/output/renderers_test.rb +4 -2
- data/test/lib/vedeu/runtime/application_test.rb +36 -32
- data/test/lib/vedeu/runtime/bootstrap_test.rb +31 -26
- data/test/lib/vedeu/runtime/flags_test.rb +33 -29
- data/test/lib/vedeu/runtime/launcher_test.rb +4 -2
- data/test/lib/vedeu/runtime/main_loop_test.rb +28 -24
- data/test/lib/vedeu/runtime/traps_test.rb +8 -4
- data/test/test_helper.rb +4 -2
- metadata +66 -63
- data/lib/vedeu/input/editor/all.rb +0 -19
- data/lib/vedeu/input/input_translator.rb +0 -155
- data/lib/vedeu/log/debug.rb +0 -79
- data/lib/vedeu/log/lockless_log_device.rb +0 -61
- data/lib/vedeu/log/log.rb +0 -172
- data/lib/vedeu/log/mono_logger.rb +0 -21
- data/lib/vedeu/log/timer.rb +0 -63
- data/lib/vedeu/models/menu.rb +0 -217
- data/lib/vedeu/models/menus.rb +0 -14
- data/lib/vedeu/output/html_char.rb +0 -161
- data/test/lib/vedeu/input/input_translator_test.rb +0 -32
- data/test/lib/vedeu/log/debug_test.rb +0 -35
- data/test/lib/vedeu/log/lockless_log_device_test.rb +0 -29
- data/test/lib/vedeu/log/log_test.rb +0 -48
- data/test/lib/vedeu/log/mono_logger_test.rb +0 -31
- data/test/lib/vedeu/log/timer_test.rb +0 -40
- data/test/lib/vedeu/models/menu_test.rb +0 -301
- data/test/lib/vedeu/models/menus_test.rb +0 -13
- data/test/lib/vedeu/output/html_char_test.rb +0 -106
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Views
|
6
|
+
|
7
|
+
describe HTMLChar do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Views::HTMLChar }
|
10
|
+
let(:instance) { described.new(char, options) }
|
11
|
+
let(:char) { Vedeu::Views::Char.new(attributes) }
|
12
|
+
let(:options) {
|
13
|
+
{
|
14
|
+
start_tag: '<td',
|
15
|
+
end_tag: '</td>',
|
16
|
+
}
|
17
|
+
}
|
18
|
+
let(:attributes) {
|
19
|
+
{
|
20
|
+
border: border,
|
21
|
+
colour: colour,
|
22
|
+
parent: parent,
|
23
|
+
value: _value
|
24
|
+
}
|
25
|
+
}
|
26
|
+
let(:border) {}
|
27
|
+
let(:colour) {}
|
28
|
+
let(:parent) { Vedeu::Views::Line.new(colour: parent_colour) }
|
29
|
+
let(:parent_colour) {}
|
30
|
+
let(:_value) {}
|
31
|
+
|
32
|
+
describe '#initialize' do
|
33
|
+
it { instance.must_be_instance_of(described) }
|
34
|
+
it { instance.instance_variable_get('@char').must_equal(char) }
|
35
|
+
it { instance.instance_variable_get('@options').must_equal(options) }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '.render' do
|
39
|
+
subject { described.render(char, options) }
|
40
|
+
|
41
|
+
it { subject.must_be_instance_of(String) }
|
42
|
+
|
43
|
+
context 'when there is a border' do
|
44
|
+
let(:border) { :top_left }
|
45
|
+
|
46
|
+
context 'when there is a colour' do
|
47
|
+
let(:colour) {
|
48
|
+
Vedeu::Colours::Colour.new(background: '#220022',
|
49
|
+
foreground: '#aadd00')
|
50
|
+
}
|
51
|
+
|
52
|
+
it { subject.must_equal(
|
53
|
+
"<td style='" \
|
54
|
+
"border:1px #220022 solid;" \
|
55
|
+
"background:#220022;" \
|
56
|
+
"color:#aadd00;" \
|
57
|
+
"border-top:1px #aadd00 solid;" \
|
58
|
+
"border-left:1px #aadd00 solid;" \
|
59
|
+
"'> </td>"
|
60
|
+
) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when there is no colour' do
|
64
|
+
context 'when there is a parent colour' do
|
65
|
+
let(:parent_colour) {
|
66
|
+
Vedeu::Colours::Colour.new(background: '#002222',
|
67
|
+
foreground: '#dd2200')
|
68
|
+
}
|
69
|
+
|
70
|
+
it { subject.must_equal(
|
71
|
+
"<td style='" \
|
72
|
+
"border:1px #002222 solid;" \
|
73
|
+
"background:#002222;" \
|
74
|
+
"color:#dd2200;" \
|
75
|
+
"border-top:1px #dd2200 solid;" \
|
76
|
+
"border-left:1px #dd2200 solid;" \
|
77
|
+
"'> </td>"
|
78
|
+
) }
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'when there is no parent colour' do
|
82
|
+
it { subject.must_equal("<td style=''> </td>") }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'when there is no border' do
|
88
|
+
context 'when there is no value' do
|
89
|
+
it { subject.must_equal('<td> </td>') }
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'when the value is empty' do
|
93
|
+
let(:_value) { '' }
|
94
|
+
|
95
|
+
it { subject.must_equal('<td> </td>') }
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'when there is a value' do
|
99
|
+
let(:_value) { 'a' }
|
100
|
+
|
101
|
+
it { subject.must_equal("<td style=''>a</td>") }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end # HTMLChar
|
107
|
+
|
108
|
+
end # Views
|
109
|
+
|
110
|
+
end # Vedeu
|
@@ -26,12 +26,16 @@ module Vedeu
|
|
26
26
|
context 'when the output is all Vedeu::Views::Char elements' do
|
27
27
|
let(:output) {
|
28
28
|
[
|
29
|
-
Vedeu::Views::Char.new(value:
|
30
|
-
|
31
|
-
Vedeu::Views::Char.new(value:
|
29
|
+
Vedeu::Views::Char.new(value: 'Y',
|
30
|
+
colour: { foreground: '#ff0000' }),
|
31
|
+
Vedeu::Views::Char.new(value: 'e',
|
32
|
+
colour: { foreground: '#ff0000' }),
|
33
|
+
Vedeu::Views::Char.new(value: 's',
|
34
|
+
colour: { foreground: '#ff0000' }),
|
32
35
|
]
|
33
36
|
}
|
34
|
-
it 'converts the non-Vedeu::Views::Char elements into String
|
37
|
+
it 'converts the non-Vedeu::Views::Char elements into String ' \
|
38
|
+
'elements' do
|
35
39
|
subject.must_equal("\e[38;2;255;0;0mYes")
|
36
40
|
end
|
37
41
|
end
|
@@ -39,10 +43,14 @@ module Vedeu
|
|
39
43
|
context 'when the output is all Vedeu::Views::Char elements' do
|
40
44
|
let(:output) {
|
41
45
|
[
|
42
|
-
Vedeu::Views::Char.new(value:
|
43
|
-
|
44
|
-
Vedeu::Views::Char.new(value:
|
45
|
-
|
46
|
+
Vedeu::Views::Char.new(value: 'a',
|
47
|
+
colour: { foreground: '#ff0000' }),
|
48
|
+
Vedeu::Views::Char.new(value: 'b',
|
49
|
+
colour: { foreground: '#ff0000' }),
|
50
|
+
Vedeu::Views::Char.new(value: 'c',
|
51
|
+
colour: { foreground: '#0000ff' }),
|
52
|
+
Vedeu::Views::Char.new(value: 'd',
|
53
|
+
colour: { foreground: '#0000ff' }),
|
46
54
|
]
|
47
55
|
}
|
48
56
|
it 'compresses multiple colours and styles where possible' do
|
@@ -50,15 +58,17 @@ module Vedeu
|
|
50
58
|
end
|
51
59
|
end
|
52
60
|
|
53
|
-
context 'when the output is not all Vedeu::Views::Char
|
61
|
+
context 'when the output is not all Vedeu::Views::Char ' \
|
62
|
+
'elements' do
|
54
63
|
let(:output) {
|
55
64
|
[
|
56
65
|
Vedeu::Views::Char.new(value: 'N'),
|
57
|
-
Vedeu::Escape.new(value: "\e[?25l"),
|
66
|
+
Vedeu::Models::Escape.new(value: "\e[?25l"),
|
58
67
|
Vedeu::Views::Char.new(value: 't'),
|
59
68
|
]
|
60
69
|
}
|
61
|
-
it 'converts the non-Vedeu::Views::Char elements into String
|
70
|
+
it 'converts the non-Vedeu::Views::Char elements into String ' \
|
71
|
+
'elements' do
|
62
72
|
subject.must_equal("N\e[1;1H\e[?25lt")
|
63
73
|
end
|
64
74
|
end
|
@@ -70,12 +80,16 @@ module Vedeu
|
|
70
80
|
context 'when the output is all Vedeu::Views::Char elements' do
|
71
81
|
let(:output) {
|
72
82
|
[
|
73
|
-
Vedeu::Views::Char.new(value:
|
74
|
-
|
75
|
-
Vedeu::Views::Char.new(value:
|
83
|
+
Vedeu::Views::Char.new(value: 'Y',
|
84
|
+
colour: { foreground: '#ff0000' }),
|
85
|
+
Vedeu::Views::Char.new(value: 'e',
|
86
|
+
colour: { foreground: '#ff0000' }),
|
87
|
+
Vedeu::Views::Char.new(value: 's',
|
88
|
+
colour: { foreground: '#ff0000' }),
|
76
89
|
]
|
77
90
|
}
|
78
|
-
it 'converts the non-Vedeu::Views::Char elements into String
|
91
|
+
it 'converts the non-Vedeu::Views::Char elements into String ' \
|
92
|
+
'elements' do
|
79
93
|
subject.must_equal(
|
80
94
|
"\e[38;2;255;0;0mY\e[38;2;255;0;0me\e[38;2;255;0;0ms"
|
81
95
|
)
|
@@ -85,15 +99,22 @@ module Vedeu
|
|
85
99
|
context 'when the output is all Vedeu::Views::Char elements' do
|
86
100
|
let(:output) {
|
87
101
|
[
|
88
|
-
Vedeu::Views::Char.new(value:
|
89
|
-
|
90
|
-
Vedeu::Views::Char.new(value:
|
91
|
-
|
102
|
+
Vedeu::Views::Char.new(value: 'a',
|
103
|
+
colour: { foreground: '#ff0000' }),
|
104
|
+
Vedeu::Views::Char.new(value: 'b',
|
105
|
+
colour: { foreground: '#ff0000' }),
|
106
|
+
Vedeu::Views::Char.new(value: 'c',
|
107
|
+
colour: { foreground: '#0000ff' }),
|
108
|
+
Vedeu::Views::Char.new(value: 'd',
|
109
|
+
colour: { foreground: '#0000ff' }),
|
92
110
|
]
|
93
111
|
}
|
94
112
|
it 'compresses multiple colours and styles where possible' do
|
95
113
|
subject.must_equal(
|
96
|
-
"\e[38;2;255;0;0ma\
|
114
|
+
"\e[38;2;255;0;0ma" \
|
115
|
+
"\e[38;2;255;0;0mb" \
|
116
|
+
"\e[38;2;0;0;255mc" \
|
117
|
+
"\e[38;2;0;0;255md"
|
97
118
|
)
|
98
119
|
end
|
99
120
|
end
|
@@ -102,11 +123,12 @@ module Vedeu
|
|
102
123
|
let(:output) {
|
103
124
|
[
|
104
125
|
Vedeu::Views::Char.new(value: 'N'),
|
105
|
-
Vedeu::Escape.new(value: "\e[?25l"),
|
126
|
+
Vedeu::Models::Escape.new(value: "\e[?25l"),
|
106
127
|
Vedeu::Views::Char.new(value: 't'),
|
107
128
|
]
|
108
129
|
}
|
109
|
-
it 'converts the non-Vedeu::Views::Char elements into String
|
130
|
+
it 'converts the non-Vedeu::Views::Char elements into String ' \
|
131
|
+
'elements' do
|
110
132
|
subject.must_equal("N\e[1;1H\e[?25lt")
|
111
133
|
end
|
112
134
|
end
|
@@ -72,9 +72,11 @@ module Vedeu
|
|
72
72
|
}
|
73
73
|
|
74
74
|
context 'when there is content' do
|
75
|
-
let(:output) {
|
75
|
+
let(:output) {
|
76
|
+
Vedeu::Models::Escape.new(value: Vedeu::Esc.hide_cursor)
|
77
|
+
}
|
76
78
|
|
77
|
-
it { subject.must_be_instance_of(Vedeu::Escape) }
|
79
|
+
it { subject.must_be_instance_of(Vedeu::Models::Escape) }
|
78
80
|
end
|
79
81
|
|
80
82
|
context 'when there is no content' do
|
@@ -2,51 +2,55 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Runtime
|
6
6
|
|
7
|
-
|
8
|
-
let(:instance) { described.new(configuration) }
|
9
|
-
let(:configuration) { Vedeu.configuration }
|
7
|
+
describe Application do
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
let(:described) { Vedeu::Runtime::Application }
|
10
|
+
let(:instance) { described.new(configuration) }
|
11
|
+
let(:configuration) { Vedeu.configuration }
|
14
12
|
|
15
|
-
|
16
|
-
|
13
|
+
before do
|
14
|
+
configuration.stubs(:drb?).returns(false)
|
15
|
+
Terminal.stubs(:open).returns([''])
|
17
16
|
|
18
|
-
|
19
|
-
it { instance.must_be_instance_of(described) }
|
20
|
-
it do
|
21
|
-
instance.instance_variable_get('@configuration').
|
22
|
-
must_equal(configuration)
|
17
|
+
Vedeu.stubs(:trigger)
|
23
18
|
end
|
24
|
-
end
|
25
19
|
|
26
|
-
|
27
|
-
|
20
|
+
describe '#initialize' do
|
21
|
+
it { instance.must_be_instance_of(described) }
|
22
|
+
it do
|
23
|
+
instance.instance_variable_get('@configuration').
|
24
|
+
must_equal(configuration)
|
25
|
+
end
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
28
|
+
describe '.restart' do
|
29
|
+
subject { described.restart(configuration) }
|
31
30
|
|
32
|
-
|
33
|
-
|
31
|
+
it { subject.must_be_instance_of(Array) }
|
32
|
+
end
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
describe '.start' do
|
35
|
+
subject { described.start(configuration) }
|
37
36
|
|
38
|
-
|
39
|
-
|
37
|
+
it { subject.must_be_instance_of(Array) }
|
38
|
+
end
|
40
39
|
|
41
|
-
|
42
|
-
|
40
|
+
describe '.stop' do
|
41
|
+
subject { described.stop }
|
43
42
|
|
44
|
-
|
45
|
-
|
43
|
+
it { subject.must_equal(false) }
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#start' do
|
47
|
+
subject { instance.start }
|
48
|
+
|
49
|
+
it { subject.must_be_instance_of(Array) }
|
50
|
+
end
|
46
51
|
|
47
|
-
|
48
|
-
end
|
52
|
+
end # Application
|
49
53
|
|
50
|
-
end #
|
54
|
+
end # Runtime
|
51
55
|
|
52
56
|
end # Vedeu
|
@@ -9,36 +9,41 @@ end # YourApp
|
|
9
9
|
|
10
10
|
module Vedeu
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
describe '.start' do
|
24
|
-
before do
|
25
|
-
Vedeu::Configuration.stubs(:root).returns([:controller, :action, :args])
|
26
|
-
Vedeu.stubs(:trigger)
|
27
|
-
Vedeu::Launcher.stubs(:execute!)
|
12
|
+
module Runtime
|
13
|
+
|
14
|
+
describe Bootstrap do
|
15
|
+
|
16
|
+
let(:described) { Vedeu::Runtime::Bootstrap }
|
17
|
+
let(:instance) { described.new(argv) }
|
18
|
+
let(:argv) { [] }
|
19
|
+
|
20
|
+
describe '#initialize' do
|
21
|
+
it { instance.must_be_instance_of(described) }
|
22
|
+
it { instance.instance_variable_get('@argv').must_equal(argv) }
|
28
23
|
end
|
29
24
|
|
30
|
-
|
25
|
+
describe '.start' do
|
26
|
+
before do
|
27
|
+
Vedeu::Configuration.stubs(:root).
|
28
|
+
returns([:controller, :action, :args])
|
29
|
+
Vedeu.stubs(:trigger)
|
30
|
+
Vedeu::Launcher.stubs(:execute!)
|
31
|
+
end
|
32
|
+
|
33
|
+
subject { described.start(argv) }
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
it {
|
36
|
+
Vedeu::Launcher.expects(:execute!)
|
37
|
+
subject
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#start' do
|
42
|
+
it { instance.must_respond_to(:start) }
|
43
|
+
end
|
37
44
|
|
38
|
-
|
39
|
-
it { instance.must_respond_to(:start) }
|
40
|
-
end
|
45
|
+
end # Bootstrap
|
41
46
|
|
42
|
-
end #
|
47
|
+
end # Runtime
|
43
48
|
|
44
49
|
end # Vedeu
|
@@ -2,46 +2,50 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Runtime
|
6
6
|
|
7
|
-
|
7
|
+
describe Flags do
|
8
8
|
|
9
|
-
|
10
|
-
it { described.ready!.must_equal(true) }
|
11
|
-
end
|
9
|
+
let(:described) { Vedeu::Runtime::Flags }
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
before do
|
16
|
-
described.reset!
|
17
|
-
described.ready!
|
18
|
-
end
|
19
|
-
|
20
|
-
it { described.ready?.must_equal(true) }
|
11
|
+
describe '.ready!' do
|
12
|
+
it { described.ready!.must_equal(true) }
|
21
13
|
end
|
22
14
|
|
23
|
-
|
24
|
-
|
25
|
-
|
15
|
+
describe '.ready?' do
|
16
|
+
context 'when Vedeu has triggered the :_initialize_ event' do
|
17
|
+
before do
|
18
|
+
described.reset!
|
19
|
+
described.ready!
|
20
|
+
end
|
21
|
+
|
22
|
+
it { described.ready?.must_equal(true) }
|
26
23
|
end
|
27
24
|
|
28
|
-
|
25
|
+
context 'when Vedeu has not triggered the :_initialize_ event' do
|
26
|
+
before do
|
27
|
+
described.reset!
|
28
|
+
end
|
29
|
+
|
30
|
+
it { described.ready?.must_equal(false) }
|
31
|
+
end
|
29
32
|
end
|
30
|
-
end
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
+
describe '.reset!' do
|
35
|
+
subject { described.reset! }
|
36
|
+
|
37
|
+
it {
|
38
|
+
subject
|
39
|
+
described.ready?.must_equal(false)
|
40
|
+
}
|
41
|
+
end
|
34
42
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
39
|
-
end
|
43
|
+
describe '#reset!' do
|
44
|
+
it { described.instance.must_respond_to(:reset!) }
|
45
|
+
end
|
40
46
|
|
41
|
-
|
42
|
-
it { described.instance.must_respond_to(:reset!) }
|
43
|
-
end
|
47
|
+
end # Flags
|
44
48
|
|
45
|
-
end #
|
49
|
+
end # Runtime
|
46
50
|
|
47
51
|
end # Vedeu
|
@@ -37,7 +37,7 @@ module Vedeu
|
|
37
37
|
|
38
38
|
describe '#execute!' do
|
39
39
|
before do
|
40
|
-
Application.stubs(:start)
|
40
|
+
Vedeu::Runtime::Application.stubs(:start)
|
41
41
|
Kernel.stubs(:exit)
|
42
42
|
Kernel.stubs(:puts)
|
43
43
|
end
|
@@ -50,7 +50,9 @@ module Vedeu
|
|
50
50
|
|
51
51
|
context 'when an uncaught exception occurs' do
|
52
52
|
before do
|
53
|
-
Vedeu::Application.
|
53
|
+
Vedeu::Runtime::Application.
|
54
|
+
stubs(:start).
|
55
|
+
raises(StandardError, 'Oops!')
|
54
56
|
Vedeu::Configuration.stubs(:debug?).returns(debug)
|
55
57
|
end
|
56
58
|
|
@@ -2,39 +2,43 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Runtime
|
6
6
|
|
7
|
-
|
7
|
+
describe MainLoop do
|
8
8
|
|
9
|
-
|
10
|
-
subject { described.start! { } }
|
11
|
-
end
|
9
|
+
let(:described) { Vedeu::Runtime::MainLoop }
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
describe '.start!' do
|
12
|
+
subject { described.start! { } }
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
subject
|
18
|
-
described.instance_variable_get('@loop').must_equal(false)
|
19
|
-
}
|
20
|
-
end
|
15
|
+
describe '.stop!' do
|
16
|
+
subject { described.stop! }
|
21
17
|
|
22
|
-
|
23
|
-
|
18
|
+
it {
|
19
|
+
subject
|
20
|
+
described.instance_variable_get('@loop').must_equal(false)
|
21
|
+
}
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
# @todo Add more tests.
|
28
|
-
# it { skip }
|
29
|
-
end
|
24
|
+
describe '.safe_exit_point!' do
|
25
|
+
subject { described.safe_exit_point! }
|
30
26
|
|
31
|
-
context 'when the
|
32
|
-
|
33
|
-
|
27
|
+
context 'when the application has started' do
|
28
|
+
context 'when the loop is running' do
|
29
|
+
# @todo Add more tests.
|
30
|
+
# it { skip }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the loop is not running' do
|
34
|
+
# @todo Add more tests.
|
35
|
+
# it { skip }
|
36
|
+
end
|
34
37
|
end
|
35
38
|
end
|
36
|
-
end
|
37
39
|
|
38
|
-
|
40
|
+
end # MainLoop
|
41
|
+
|
42
|
+
end # Runtime
|
39
43
|
|
40
44
|
end # Vedeu
|
@@ -2,11 +2,15 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Runtime
|
6
6
|
|
7
|
-
|
8
|
-
# it { skip }
|
7
|
+
describe Traps do
|
9
8
|
|
10
|
-
|
9
|
+
# @todo Add more tests.
|
10
|
+
# it { skip }
|
11
|
+
|
12
|
+
end # Traps
|
13
|
+
|
14
|
+
end # Runtime
|
11
15
|
|
12
16
|
end # Vedeu
|
data/test/test_helper.rb
CHANGED
@@ -25,15 +25,17 @@ unless ENV['NO_SIMPLECOV']
|
|
25
25
|
add_group 'cursors', 'vedeu/cursors'
|
26
26
|
add_group 'distributed', 'vedeu/distributed'
|
27
27
|
add_group 'dsl', 'vedeu/dsl'
|
28
|
+
add_group 'editor', 'vedeu/editor'
|
28
29
|
add_group 'esc', 'vedeu/esc'
|
29
30
|
add_group 'events', 'vedeu/events'
|
30
31
|
add_group 'geometry', 'vedeu/geometry'
|
31
32
|
add_group 'input', 'vedeu/input'
|
32
|
-
add_group 'log', 'vedeu/
|
33
|
+
add_group 'log', 'vedeu/logging'
|
34
|
+
add_group 'menus', 'vedeu/menus'
|
33
35
|
add_group 'models', 'vedeu/models'
|
34
36
|
add_group 'null', 'vedeu/null'
|
35
37
|
add_group 'output', 'vedeu/output'
|
36
|
-
add_group 'plugins', 'vedeu/
|
38
|
+
add_group 'plugins', 'vedeu/plugins'
|
37
39
|
add_group 'refresh', 'vedeu/refresh'
|
38
40
|
add_group 'repositories', 'vedeu/repositories'
|
39
41
|
add_group 'runtime', 'vedeu/runtime'
|