vedeu 0.4.13 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.travis.yml +2 -1
- data/Guardfile +6 -5
- data/README.md +3 -30
- data/Rakefile +5 -5
- data/bin/vedeu_drb_client +1 -1
- data/bin/vedeu_drb_server +91 -89
- data/bin/vedeu_test +4 -0
- data/config/rubocop_enabled.yml +5 -10
- data/examples/borders_app.rb +2 -1
- data/examples/colours_app.rb +13 -8
- data/examples/configuration_app.rb +3 -2
- data/examples/cursor_app.rb +16 -11
- data/examples/drb_app.rb +88 -89
- data/examples/focus_app.rb +31 -32
- data/examples/geometry_app.rb +2 -1
- data/examples/hello_world.rb +2 -1
- data/examples/lines_app.rb +2 -1
- data/examples/material_colours_app.rb +126 -0
- data/examples/typed_commands/typed_commands_app.rb +5 -1
- data/examples/view_templates_app/view_templates_app.rb +6 -3
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/api.rb +18 -10
- data/lib/vedeu/application.rb +0 -1
- data/lib/vedeu/bindings.rb +77 -16
- data/lib/vedeu/buffers/all.rb +2 -5
- data/lib/vedeu/buffers/buffer.rb +69 -25
- data/lib/vedeu/buffers/display_buffer.rb +3 -7
- data/lib/vedeu/configuration/all.rb +3 -6
- data/lib/vedeu/configuration/api.rb +28 -4
- data/lib/vedeu/configuration/cli.rb +9 -9
- data/lib/vedeu/configuration/configuration.rb +11 -7
- data/lib/vedeu/cursor/all.rb +3 -6
- data/lib/vedeu/cursor/cursor.rb +22 -14
- data/lib/vedeu/cursor/move.rb +32 -22
- data/lib/vedeu/cursor/refresh_cursor.rb +1 -1
- data/lib/vedeu/debug.rb +2 -1
- data/lib/vedeu/distributed/client.rb +1 -7
- data/lib/vedeu/distributed/server.rb +0 -4
- data/lib/vedeu/distributed/subprocess.rb +1 -1
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -1
- data/lib/vedeu/distributed/test_application.rb +3 -5
- data/lib/vedeu/distributed/uri.rb +2 -2
- data/lib/vedeu/dsl/all.rb +6 -6
- data/lib/vedeu/dsl/components/all.rb +0 -3
- data/lib/vedeu/dsl/components/border.rb +20 -12
- data/lib/vedeu/dsl/components/geometry.rb +68 -3
- data/lib/vedeu/dsl/components/keymap.rb +1 -2
- data/lib/vedeu/dsl/composition.rb +8 -1
- data/lib/vedeu/dsl/interface.rb +61 -11
- data/lib/vedeu/dsl/line.rb +12 -12
- data/lib/vedeu/dsl/shared/all.rb +4 -7
- data/lib/vedeu/dsl/shared/colour.rb +2 -2
- data/lib/vedeu/dsl/shared/text.rb +2 -35
- data/lib/vedeu/dsl/shared/use.rb +2 -2
- data/lib/vedeu/dsl/view.rb +4 -4
- data/lib/vedeu/events/all.rb +3 -5
- data/lib/vedeu/events/event.rb +5 -5
- data/lib/vedeu/geometry/all.rb +11 -16
- data/lib/vedeu/geometry/area.rb +2 -5
- data/lib/vedeu/geometry/canvas.rb +12 -16
- data/lib/vedeu/geometry/dimension.rb +20 -22
- data/lib/vedeu/geometry/geometry.rb +28 -30
- data/lib/vedeu/geometry/grid.rb +1 -1
- data/lib/vedeu/geometry/index_position.rb +7 -0
- data/lib/vedeu/geometry/null_geometry.rb +61 -0
- data/lib/vedeu/geometry/position.rb +0 -3
- data/lib/vedeu/geometry/position_index.rb +7 -0
- data/lib/vedeu/geometry/position_validator.rb +44 -33
- data/lib/vedeu/input/all.rb +5 -4
- data/lib/vedeu/input/keymap.rb +0 -1
- data/lib/vedeu/input/mapper.rb +1 -3
- data/lib/vedeu/launcher.rb +6 -7
- data/lib/vedeu/main_loop.rb +1 -2
- data/lib/vedeu/models/all.rb +1 -0
- data/lib/vedeu/models/cell.rb +5 -8
- data/lib/vedeu/models/char.rb +50 -15
- data/lib/vedeu/models/composition.rb +8 -1
- data/lib/vedeu/models/focus.rb +4 -4
- data/lib/vedeu/models/group.rb +3 -3
- data/lib/vedeu/models/interface.rb +62 -46
- data/lib/vedeu/models/line.rb +1 -1
- data/lib/vedeu/models/null.rb +48 -0
- data/lib/vedeu/models/stream.rb +5 -5
- data/lib/vedeu/output/all.rb +20 -30
- data/lib/vedeu/output/border.rb +93 -40
- data/lib/vedeu/output/clear.rb +100 -15
- data/lib/vedeu/output/colour.rb +56 -12
- data/lib/vedeu/output/compressor.rb +59 -0
- data/lib/vedeu/output/html_char.rb +4 -2
- data/lib/vedeu/output/null_border.rb +16 -4
- data/lib/vedeu/output/output.rb +13 -21
- data/lib/vedeu/output/presentation.rb +28 -23
- data/lib/vedeu/output/refresh.rb +2 -2
- data/lib/vedeu/output/renderers/all.rb +80 -3
- data/lib/vedeu/output/renderers/file_renderer.rb +38 -2
- data/lib/vedeu/output/renderers/html_renderer.rb +6 -4
- data/lib/vedeu/output/renderers/json_renderer.rb +52 -0
- data/lib/vedeu/output/renderers/null_renderer.rb +14 -0
- data/lib/vedeu/output/renderers/terminal_renderer.rb +2 -12
- data/lib/vedeu/output/style.rb +33 -3
- data/lib/vedeu/output/text.rb +98 -1
- data/lib/vedeu/output/translator.rb +30 -7
- data/lib/vedeu/output/viewport.rb +43 -79
- data/lib/vedeu/output/wordwrap.rb +4 -4
- data/lib/vedeu/repositories/all.rb +22 -179
- data/lib/vedeu/repositories/collection.rb +11 -13
- data/lib/vedeu/repositories/collections/all.rb +8 -0
- data/lib/vedeu/repositories/collections/chars.rb +9 -0
- data/lib/vedeu/repositories/collections/events.rb +9 -0
- data/lib/vedeu/repositories/collections/interfaces.rb +9 -0
- data/lib/vedeu/repositories/collections/keys.rb +9 -0
- data/lib/vedeu/repositories/collections/lines.rb +9 -0
- data/lib/vedeu/repositories/collections/streams.rb +9 -0
- data/lib/vedeu/repositories/model.rb +7 -2
- data/lib/vedeu/repositories/repositories/all.rb +14 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/borders.rb +38 -0
- data/lib/vedeu/repositories/repositories/buffers.rb +36 -0
- data/lib/vedeu/repositories/repositories/colours.rb +63 -0
- data/lib/vedeu/repositories/repositories/cursors.rb +29 -0
- data/lib/vedeu/repositories/repositories/events_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/geometries.rb +37 -0
- data/lib/vedeu/repositories/repositories/groups.rb +24 -0
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/keymaps.rb +24 -0
- data/lib/vedeu/repositories/repositories/menus.rb +24 -0
- data/lib/vedeu/repositories/repository.rb +29 -47
- data/lib/vedeu/storage/all.rb +6 -0
- data/lib/vedeu/storage/associative_store.rb +47 -0
- data/lib/vedeu/storage/conveyor_store.rb +69 -0
- data/lib/vedeu/storage/fifo_store.rb +37 -0
- data/lib/vedeu/storage/store.rb +58 -0
- data/lib/vedeu/support/all.rb +5 -10
- data/lib/vedeu/support/common.rb +0 -8
- data/lib/vedeu/support/log.rb +13 -24
- data/lib/vedeu/support/template.rb +4 -1
- data/lib/vedeu/support/terminal.rb +10 -10
- data/lib/vedeu/support/trace.rb +15 -88
- data/lib/vedeu/support/visibility.rb +73 -0
- data/lib/vedeu.rb +37 -0
- data/test/lib/vedeu/api_test.rb +7 -3
- data/test/lib/vedeu/application_test.rb +9 -3
- data/test/lib/vedeu/bindings_test.rb +21 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +110 -134
- data/test/lib/vedeu/buffers/display_buffer_test.rb +8 -0
- data/test/lib/vedeu/configuration/api_test.rb +5 -1
- data/test/lib/vedeu/configuration/configuration_test.rb +4 -6
- data/test/lib/vedeu/cursor/cursor_test.rb +25 -17
- data/test/lib/vedeu/cursor/move_test.rb +7 -7
- data/test/lib/vedeu/distributed/client_test.rb +1 -1
- data/test/lib/vedeu/distributed/subprocess_test.rb +3 -1
- data/test/lib/vedeu/distributed/uri_test.rb +5 -5
- data/test/lib/vedeu/dsl/components/geometry_test.rb +43 -0
- data/test/lib/vedeu/dsl/components/keymap_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +6 -5
- data/test/lib/vedeu/dsl/interface_test.rb +81 -16
- data/test/lib/vedeu/dsl/shared/colour_test.rb +4 -4
- data/test/lib/vedeu/dsl/shared/text_test.rb +87 -9
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/events/event_test.rb +3 -1
- data/test/lib/vedeu/events/trigger_test.rb +8 -4
- data/test/lib/vedeu/geometry/dimension_test.rb +1 -1
- data/test/lib/vedeu/geometry/geometry_test.rb +5 -3
- data/test/lib/vedeu/geometry/index_position_test.rb +30 -7
- data/test/lib/vedeu/geometry/null_geometry_test.rb +57 -0
- data/test/lib/vedeu/geometry/position_index_test.rb +14 -0
- data/test/lib/vedeu/geometry/position_validator_test.rb +17 -3
- data/test/lib/vedeu/input/keymap_test.rb +3 -1
- data/test/lib/vedeu/input/mapper_test.rb +8 -4
- data/test/lib/vedeu/launcher_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +10 -8
- data/test/lib/vedeu/models/char_test.rb +52 -28
- data/test/lib/vedeu/models/composition_test.rb +26 -4
- data/test/lib/vedeu/models/group_test.rb +11 -5
- data/test/lib/vedeu/models/interface_test.rb +32 -19
- data/test/lib/vedeu/models/line_test.rb +21 -25
- data/test/lib/vedeu/models/menu_test.rb +10 -6
- data/test/lib/vedeu/models/null_test.rb +66 -0
- data/test/lib/vedeu/models/stream_test.rb +13 -10
- data/test/lib/vedeu/output/border_test.rb +29 -8
- data/test/lib/vedeu/output/clear_test.rb +23 -4
- data/test/lib/vedeu/output/colour_test.rb +20 -4
- data/test/lib/vedeu/output/compressor_test.rb +43 -0
- data/test/lib/vedeu/output/html_char_test.rb +29 -17
- data/test/lib/vedeu/output/null_border_test.rb +2 -1
- data/test/lib/vedeu/output/output_test.rb +20 -30
- data/test/lib/vedeu/output/presentation_test.rb +39 -16
- data/test/lib/vedeu/output/refresh_test.rb +14 -10
- data/test/lib/vedeu/output/renderers/all_test.rb +96 -0
- data/test/lib/vedeu/output/renderers/file_renderer_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/html_renderer_test.rb +13 -9
- data/test/lib/vedeu/output/renderers/json_renderer_test.rb +52 -0
- data/test/lib/vedeu/output/renderers/null_renderer_test.rb +19 -0
- data/test/lib/vedeu/output/style_test.rb +41 -1
- data/test/lib/vedeu/output/text_test.rb +61 -10
- data/test/lib/vedeu/output/translator_test.rb +14 -0
- data/test/lib/vedeu/output/viewport_test.rb +22 -3
- data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -3
- data/test/lib/vedeu/output/wordwrap_test.rb +58 -45
- data/test/lib/vedeu/repositories/collections/chars_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/events_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/interfaces_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/keys_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/lines_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/streams_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/background_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/borders_test.rb +51 -0
- data/test/lib/vedeu/repositories/repositories/buffers_test.rb +52 -0
- data/test/lib/vedeu/repositories/repositories/colours_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/cursors_test.rb +39 -0
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/foreground_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/geometries_test.rb +42 -0
- data/test/lib/vedeu/repositories/repositories/groups_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repositories_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +17 -0
- data/test/lib/vedeu/repositories/repository_test.rb +16 -36
- data/test/lib/vedeu/storage/associative_store_test.rb +69 -0
- data/test/lib/vedeu/storage/conveyor_store_test.rb +135 -0
- data/test/lib/vedeu/storage/fifo_store_test.rb +47 -0
- data/test/lib/vedeu/storage/store_test.rb +123 -0
- data/test/lib/vedeu/support/common_test.rb +0 -9
- data/test/lib/vedeu/support/terminal_test.rb +78 -55
- data/test/lib/vedeu/support/visibility_test.rb +80 -0
- data/test/test_helper.rb +13 -11
- data/vedeu.gemspec +4 -3
- metadata +92 -32
- data/lib/vedeu/cursor/toggle.rb +0 -55
- data/lib/vedeu/exceptions.rb +0 -37
- data/lib/vedeu/geometry/centre.rb +0 -85
- data/lib/vedeu/geometry/content.rb +0 -70
- data/lib/vedeu/geometry/limit.rb +0 -58
- data/lib/vedeu/output/compositor.rb +0 -62
- data/lib/vedeu/repositories/collections.rb +0 -41
- data/lib/vedeu/support/coercions.rb +0 -60
- data/lib/vedeu/support/sentence.rb +0 -91
- data/lib/vedeu/support/visible.rb +0 -90
- data/test/lib/vedeu/cursor/toggle_test.rb +0 -63
- data/test/lib/vedeu/geometry/centre_test.rb +0 -58
- data/test/lib/vedeu/geometry/content_test.rb +0 -98
- data/test/lib/vedeu/geometry/limit_test.rb +0 -30
- data/test/lib/vedeu/output/compositor_test.rb +0 -48
- data/test/lib/vedeu/repositories/all_test.rb +0 -135
- data/test/lib/vedeu/repositories/collections_test.rb +0 -71
- data/test/lib/vedeu/support/coercions_test.rb +0 -84
- data/test/lib/vedeu/support/sentence_test.rb +0 -56
- data/test/lib/vedeu/support/visible_test.rb +0 -161
@@ -5,8 +5,17 @@ module Vedeu
|
|
5
5
|
describe Buffer do
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Buffer }
|
8
|
-
let(:instance) { described.new(
|
9
|
-
let(:
|
8
|
+
let(:instance) { described.new(attributes) }
|
9
|
+
let(:attributes) {
|
10
|
+
{
|
11
|
+
name: _name,
|
12
|
+
back: back,
|
13
|
+
front: front,
|
14
|
+
previous: previous,
|
15
|
+
repository: repository,
|
16
|
+
}
|
17
|
+
}
|
18
|
+
let(:_name) { 'krypton' }
|
10
19
|
let(:back) {}
|
11
20
|
let(:front) {}
|
12
21
|
let(:previous) {}
|
@@ -16,11 +25,13 @@ module Vedeu
|
|
16
25
|
|
17
26
|
describe '#initialize' do
|
18
27
|
it { instance.must_be_instance_of(described) }
|
19
|
-
it { instance.instance_variable_get('@name').must_equal(
|
28
|
+
it { instance.instance_variable_get('@name').must_equal(_name) }
|
20
29
|
it { instance.instance_variable_get('@back').must_equal(back) }
|
21
30
|
it { instance.instance_variable_get('@front').must_equal(front) }
|
22
31
|
it { instance.instance_variable_get('@previous').must_equal(previous) }
|
23
|
-
it
|
32
|
+
it do
|
33
|
+
instance.instance_variable_get('@repository').must_equal(Vedeu.buffers)
|
34
|
+
end
|
24
35
|
end
|
25
36
|
|
26
37
|
describe '#add' do
|
@@ -52,136 +63,101 @@ module Vedeu
|
|
52
63
|
end
|
53
64
|
end
|
54
65
|
|
55
|
-
describe '#content' do
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
end
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
let(:front) {
|
151
|
-
Vedeu.interface 'buffer' do
|
152
|
-
lines do
|
153
|
-
line 'front'
|
154
|
-
end
|
155
|
-
end
|
156
|
-
}
|
157
|
-
let(:previous) {
|
158
|
-
Vedeu.interface 'buffer' do
|
159
|
-
lines do
|
160
|
-
line 'previous'
|
161
|
-
end
|
162
|
-
end
|
163
|
-
}
|
164
|
-
|
165
|
-
context 'when the buffer was updated successfully' do
|
166
|
-
it { subject.must_equal(true) }
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'replaces the previous buffer with the front buffer' do
|
170
|
-
subject
|
171
|
-
instance.previous.must_equal(front)
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'replaces the front buffer with the back buffer' do
|
175
|
-
subject
|
176
|
-
instance.front.must_equal(back)
|
177
|
-
end
|
178
|
-
|
179
|
-
it 'replaces the back buffer with an empty buffer' do
|
180
|
-
subject
|
181
|
-
instance.back.must_equal(nil)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
66
|
+
# describe '#content' do
|
67
|
+
# subject { instance.content }
|
68
|
+
|
69
|
+
# it { subject.must_be_instance_of(Array) }
|
70
|
+
|
71
|
+
# context 'when there is content on the back buffer' do
|
72
|
+
# before { Vedeu::Output.stubs(:render) }
|
73
|
+
|
74
|
+
# let(:back) {
|
75
|
+
# Vedeu.interface 'buffer' do
|
76
|
+
# lines do
|
77
|
+
# line 'old_back'
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# }
|
81
|
+
# let(:front) {
|
82
|
+
# Vedeu.interface 'buffer' do
|
83
|
+
# lines do
|
84
|
+
# line 'front'
|
85
|
+
# end
|
86
|
+
# end
|
87
|
+
# }
|
88
|
+
# let(:previous) {
|
89
|
+
# Vedeu.interface 'buffer' do
|
90
|
+
# lines do
|
91
|
+
# line 'previous'
|
92
|
+
# end
|
93
|
+
# end
|
94
|
+
# }
|
95
|
+
# let(:buffer) { :back }
|
96
|
+
|
97
|
+
# it { subject.must_equal([back]) }
|
98
|
+
|
99
|
+
# it 'replaces the previous buffer with the front buffer' do
|
100
|
+
# subject
|
101
|
+
# instance.previous.must_equal(front)
|
102
|
+
# end
|
103
|
+
|
104
|
+
# it 'replaces the front buffer with the back buffer' do
|
105
|
+
# subject
|
106
|
+
# instance.front.must_equal(back)
|
107
|
+
# end
|
108
|
+
|
109
|
+
# it 'replaces the back buffer with an empty buffer' do
|
110
|
+
# subject
|
111
|
+
# instance.back.must_equal(nil)
|
112
|
+
# end
|
113
|
+
# end
|
114
|
+
|
115
|
+
# context 'when there is no content on the back buffer' do
|
116
|
+
# let(:buffer) { :back }
|
117
|
+
|
118
|
+
# it { subject.must_equal([]) }
|
119
|
+
# end
|
120
|
+
|
121
|
+
# context 'when there is content on the front buffer' do
|
122
|
+
# before { Vedeu::Output.stubs(:render) }
|
123
|
+
# let(:buffer) { :front }
|
124
|
+
# let(:front) {
|
125
|
+
# Vedeu.interface 'buffer' do
|
126
|
+
# lines do
|
127
|
+
# line 'front'
|
128
|
+
# end
|
129
|
+
# end
|
130
|
+
# }
|
131
|
+
|
132
|
+
# it { subject.must_equal([front]) }
|
133
|
+
# end
|
134
|
+
|
135
|
+
# context 'when there is no content on the front buffer' do
|
136
|
+
# let(:buffer) { :front }
|
137
|
+
|
138
|
+
# it { subject.must_equal([]) }
|
139
|
+
# end
|
140
|
+
|
141
|
+
# context 'when there is content on the previous buffer' do
|
142
|
+
# before { Vedeu::Output.stubs(:render) }
|
143
|
+
# let(:buffer) { :previous }
|
144
|
+
# let(:previous) {
|
145
|
+
# Vedeu.interface 'buffer' do
|
146
|
+
# lines do
|
147
|
+
# line 'old_back'
|
148
|
+
# end
|
149
|
+
# end
|
150
|
+
# }
|
151
|
+
|
152
|
+
# it { subject.must_equal([previous]) }
|
153
|
+
# end
|
154
|
+
|
155
|
+
# context 'when there is no content on the previous buffer' do
|
156
|
+
# let(:buffer) { :previous }
|
157
|
+
|
158
|
+
# it { subject.must_equal([]) }
|
159
|
+
# end
|
160
|
+
# end
|
185
161
|
|
186
162
|
end # Buffer
|
187
163
|
|
@@ -6,10 +6,18 @@ module Vedeu
|
|
6
6
|
include Vedeu::Model
|
7
7
|
include Vedeu::DisplayBuffer
|
8
8
|
|
9
|
+
def colour
|
10
|
+
Vedeu::Colour.new(background: '#000000', foreground: '#ffffff')
|
11
|
+
end
|
12
|
+
|
9
13
|
def name
|
10
14
|
'test_interface_model'
|
11
15
|
end
|
12
16
|
|
17
|
+
def style
|
18
|
+
Vedeu::Style.new(:normal)
|
19
|
+
end
|
20
|
+
|
13
21
|
private
|
14
22
|
|
15
23
|
def repository
|
@@ -279,7 +279,11 @@ module Vedeu
|
|
279
279
|
methods_and_keys.each do |meth, _|
|
280
280
|
invalid_params.each do |param|
|
281
281
|
context 'when the parameter is invalid' do
|
282
|
-
it {
|
282
|
+
it {
|
283
|
+
proc {
|
284
|
+
Vedeu.configure { send(meth, param) }
|
285
|
+
}.must_raise(InvalidSyntax)
|
286
|
+
}
|
283
287
|
end
|
284
288
|
end
|
285
289
|
end
|
@@ -19,12 +19,10 @@ module Vedeu
|
|
19
19
|
|
20
20
|
describe '.default_system_keys' do
|
21
21
|
it 'returns the default system keys' do
|
22
|
-
Configuration.default_system_keys.must_equal(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
mode_switch: :escape,
|
27
|
-
})
|
22
|
+
Configuration.default_system_keys.must_equal(exit: 'q',
|
23
|
+
focus_next: :tab,
|
24
|
+
focus_prev: :shift_tab,
|
25
|
+
mode_switch: :escape,)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
@@ -13,7 +13,7 @@ module Vedeu
|
|
13
13
|
ox: ox,
|
14
14
|
oy: oy,
|
15
15
|
repository: repository,
|
16
|
-
|
16
|
+
visible: visible,
|
17
17
|
x: x,
|
18
18
|
y: y,
|
19
19
|
}
|
@@ -22,32 +22,39 @@ module Vedeu
|
|
22
22
|
let(:ox) { 3 }
|
23
23
|
let(:oy) { 2 }
|
24
24
|
let(:repository) { Vedeu.cursors }
|
25
|
-
let(:
|
25
|
+
let(:visible) { true }
|
26
26
|
let(:x) { 19 }
|
27
27
|
let(:y) { 8 }
|
28
28
|
|
29
29
|
describe '#initialize' do
|
30
|
-
|
31
|
-
|
32
|
-
it {
|
33
|
-
it {
|
34
|
-
it {
|
35
|
-
it {
|
36
|
-
it {
|
37
|
-
it {
|
38
|
-
|
39
|
-
it {
|
30
|
+
subject { instance }
|
31
|
+
|
32
|
+
it { subject.must_be_instance_of(Cursor) }
|
33
|
+
it { subject.instance_variable_get('@name').must_equal('silver') }
|
34
|
+
it { subject.instance_variable_get('@ox').must_equal(3) }
|
35
|
+
it { subject.instance_variable_get('@oy').must_equal(2) }
|
36
|
+
it { subject.instance_variable_get('@repository').must_equal(repository) }
|
37
|
+
it { subject.instance_variable_get('@visible').must_equal(true) }
|
38
|
+
it { subject.instance_variable_get('@x').must_equal(19) }
|
39
|
+
it { subject.instance_variable_get('@y').must_equal(8) }
|
40
|
+
|
41
|
+
it do
|
42
|
+
subject.instance_variable_get('@position').
|
43
|
+
must_be_instance_of(Vedeu::Position)
|
44
|
+
end
|
40
45
|
end
|
41
46
|
|
42
47
|
describe '#inspect' do
|
43
48
|
subject { instance.inspect }
|
44
49
|
|
45
50
|
it { subject.must_be_instance_of(String) }
|
46
|
-
it { subject.must_equal(
|
51
|
+
it { subject.must_equal(
|
52
|
+
'<Vedeu::Cursor (silver, true, x:19, y:8, ox:3, oy:2)>'
|
53
|
+
) }
|
47
54
|
end
|
48
55
|
|
49
56
|
describe '#to_s' do
|
50
|
-
let(:
|
57
|
+
let(:visible) { true }
|
51
58
|
|
52
59
|
subject { instance.to_s }
|
53
60
|
|
@@ -60,7 +67,7 @@ module Vedeu
|
|
60
67
|
end
|
61
68
|
|
62
69
|
context 'when the cursor is invisible' do
|
63
|
-
let(:
|
70
|
+
let(:visible) { false }
|
64
71
|
|
65
72
|
it 'returns the invisible cursor escape sequence with position' do
|
66
73
|
subject.must_equal("\e[8;19H\e[?25l")
|
@@ -74,8 +81,9 @@ module Vedeu
|
|
74
81
|
end
|
75
82
|
}
|
76
83
|
|
77
|
-
it 'returns the escape sequence to position and set the visibility
|
78
|
-
'the cursor and returns to that position after yielding the
|
84
|
+
it 'returns the escape sequence to position and set the visibility ' \
|
85
|
+
'of the cursor and returns to that position after yielding the ' \
|
86
|
+
'block' do
|
79
87
|
subject.must_equal("\e[8;19H\e[?25h\e[8;19H\e[?25h")
|
80
88
|
end
|
81
89
|
end
|
@@ -7,12 +7,12 @@ module Vedeu
|
|
7
7
|
let(:described) { Vedeu::Move }
|
8
8
|
let(:instance) { described.new(cursor, interface, dy, dx) }
|
9
9
|
let(:cursor) {
|
10
|
-
Cursor.new(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
Cursor.new(name: 'Move',
|
11
|
+
ox: ox,
|
12
|
+
oy: oy,
|
13
|
+
visible: true,
|
14
|
+
x: x,
|
15
|
+
y: y)
|
16
16
|
}
|
17
17
|
let(:ox) { 0 }
|
18
18
|
let(:oy) { 0 }
|
@@ -75,7 +75,7 @@ module Vedeu
|
|
75
75
|
Vedeu.cursors.reset
|
76
76
|
|
77
77
|
interface_with_border
|
78
|
-
Vedeu::Cursor.new(
|
78
|
+
Vedeu::Cursor.new(name: 'manganese', oy: 2, ox: 3, x: 8, y: 7).store
|
79
79
|
end
|
80
80
|
|
81
81
|
subject { Move.by_name(direction, _name) }
|
@@ -19,7 +19,7 @@ module Vedeu
|
|
19
19
|
|
20
20
|
describe '#initialize' do
|
21
21
|
it { instance.must_be_instance_of(described) }
|
22
|
-
it { instance.instance_variable_get('@uri').must_equal(
|
22
|
+
it { instance.instance_variable_get('@uri').must_equal(uri) }
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '.connect' do
|
@@ -12,7 +12,9 @@ module Vedeu
|
|
12
12
|
subject { instance }
|
13
13
|
|
14
14
|
it { subject.must_be_instance_of(Vedeu::Subprocess) }
|
15
|
-
it
|
15
|
+
it do
|
16
|
+
subject.instance_variable_get('@application').must_equal(application)
|
17
|
+
end
|
16
18
|
end
|
17
19
|
|
18
20
|
end # Subprocess
|
@@ -16,7 +16,7 @@ module Vedeu
|
|
16
16
|
|
17
17
|
it { subject.must_be_instance_of(described) }
|
18
18
|
it { subject.instance_variable_get('@host').must_equal('localhost') }
|
19
|
-
it { subject.instance_variable_get('@port').must_equal(
|
19
|
+
it { subject.instance_variable_get('@port').must_equal(21_420) }
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#host' do
|
@@ -41,23 +41,23 @@ module Vedeu
|
|
41
41
|
subject { instance.port }
|
42
42
|
|
43
43
|
context 'when the port has been defined by the client application' do
|
44
|
-
let(:port) {
|
44
|
+
let(:port) { 40_000 }
|
45
45
|
|
46
46
|
it 'returns the port' do
|
47
|
-
subject.must_equal(
|
47
|
+
subject.must_equal(40_000)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'when the port has not been redefined' do
|
52
52
|
it 'returns the default port' do
|
53
|
-
subject.must_equal(
|
53
|
+
subject.must_equal(21_420)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe '#to_s' do
|
59
59
|
let(:host) { 'myserver' }
|
60
|
-
let(:port) {
|
60
|
+
let(:port) { 40_000 }
|
61
61
|
|
62
62
|
subject { instance.to_s }
|
63
63
|
|
@@ -79,6 +79,25 @@ module Vedeu
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
# describe '#use' do
|
83
|
+
# subject {
|
84
|
+
# Vedeu::Geometry.build({ name: 'hydrogen' }) { use 'helium' }
|
85
|
+
# }
|
86
|
+
|
87
|
+
# context 'when the named geometry does not exist' do
|
88
|
+
# end
|
89
|
+
|
90
|
+
# context 'when the named geometry exists' do
|
91
|
+
# before do
|
92
|
+
# Vedeu::Geometry.build({ name: 'helium', x: 5 }).store
|
93
|
+
# end
|
94
|
+
|
95
|
+
# it { subject.must_be_instance_of(Vedeu::Geometry) }
|
96
|
+
# it { subject.name.must_equal('hydrogen') }
|
97
|
+
# it { subject.x.must_equal(5) }
|
98
|
+
# end
|
99
|
+
# end
|
100
|
+
|
82
101
|
describe '#width' do
|
83
102
|
subject { Vedeu::Geometry.build({}) { width 25 } }
|
84
103
|
|
@@ -211,6 +230,18 @@ module Vedeu
|
|
211
230
|
subject { Vedeu::Geometry.build({}) { xn 15 } }
|
212
231
|
|
213
232
|
it { subject.xn.must_equal(15) }
|
233
|
+
|
234
|
+
context 'when a block is given' do
|
235
|
+
subject {
|
236
|
+
Vedeu::Geometry.build({}) do
|
237
|
+
xn do
|
238
|
+
8 + 8
|
239
|
+
end
|
240
|
+
end
|
241
|
+
}
|
242
|
+
|
243
|
+
it { subject.xn.must_equal(16) }
|
244
|
+
end
|
214
245
|
end
|
215
246
|
|
216
247
|
describe '#yn' do
|
@@ -219,6 +250,18 @@ module Vedeu
|
|
219
250
|
subject { Vedeu::Geometry.build({}) { yn 8 } }
|
220
251
|
|
221
252
|
it { subject.yn.must_equal(8) }
|
253
|
+
|
254
|
+
context 'when a block is given' do
|
255
|
+
subject {
|
256
|
+
Vedeu::Geometry.build({}) do
|
257
|
+
yn do
|
258
|
+
5 + 3
|
259
|
+
end
|
260
|
+
end
|
261
|
+
}
|
262
|
+
|
263
|
+
it { subject.yn.must_equal(8) }
|
264
|
+
end
|
222
265
|
end
|
223
266
|
|
224
267
|
end # Geometry
|
@@ -8,7 +8,7 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::Keymap }
|
10
10
|
let(:instance) { described.new(model) }
|
11
|
-
let(:model) { Vedeu::Keymap.new(
|
11
|
+
let(:model) { Vedeu::Keymap.new(name: '_test_') }
|
12
12
|
|
13
13
|
describe '#initialize' do
|
14
14
|
it { instance.must_be_instance_of(described) }
|
@@ -39,15 +39,16 @@ module Vedeu
|
|
39
39
|
let(:content) { "Hydrogen\nCarbon\nOxygen\nNitrogen" }
|
40
40
|
let(:as_lines) {
|
41
41
|
[
|
42
|
-
Vedeu::Line.new(
|
43
|
-
Vedeu::Line.new(
|
44
|
-
Vedeu::Line.new(
|
45
|
-
Vedeu::Line.new(
|
42
|
+
Vedeu::Line.new(streams: [Vedeu::Stream.new(value: 'Hydrogen')]),
|
43
|
+
Vedeu::Line.new(streams: [Vedeu::Stream.new(value: 'Carbon')]),
|
44
|
+
Vedeu::Line.new(streams: [Vedeu::Stream.new(value: 'Oxygen')]),
|
45
|
+
Vedeu::Line.new(streams: [Vedeu::Stream.new(value: 'Nitrogen')])
|
46
46
|
]
|
47
47
|
}
|
48
48
|
|
49
49
|
before do
|
50
|
-
Vedeu::Template.expects(:parse).
|
50
|
+
Vedeu::Template.expects(:parse).
|
51
|
+
with(object, filename).returns(content)
|
51
52
|
end
|
52
53
|
|
53
54
|
subject { instance.template_for(_name, filename, object) }
|