vedeu 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/README.md +1 -1
- data/docs/api.md +60 -67
- data/docs/configuration.md +8 -5
- data/docs/events.md +31 -15
- data/docs/events/application.md +12 -0
- data/docs/events/document.md +57 -0
- data/docs/events/drb.md +43 -0
- data/docs/events/focus.md +24 -0
- data/docs/events/menu.md +57 -0
- data/docs/events/movement.md +57 -0
- data/docs/events/refresh.md +25 -0
- data/docs/events/system.md +90 -0
- data/docs/events/visibility.md +68 -0
- data/lib/vedeu.rb +2 -2
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api.rb +18 -18
- data/lib/vedeu/application/controller.rb +1 -1
- data/lib/vedeu/application/helper.rb +1 -1
- data/lib/vedeu/application/view.rb +1 -1
- data/lib/vedeu/bindings/application.rb +1 -12
- data/lib/vedeu/bindings/bindings.rb +3 -1
- data/lib/vedeu/bindings/document.rb +9 -62
- data/lib/vedeu/bindings/drb.rb +12 -56
- data/lib/vedeu/bindings/focus.rb +3 -28
- data/lib/vedeu/bindings/menus.rb +10 -66
- data/lib/vedeu/bindings/movement.rb +4 -69
- data/lib/vedeu/bindings/refresh.rb +3 -33
- data/lib/vedeu/bindings/system.rb +14 -100
- data/lib/vedeu/bindings/visibility.rb +20 -71
- data/lib/vedeu/borders/all.rb +4 -3
- data/lib/vedeu/borders/border.rb +39 -33
- data/lib/vedeu/borders/dsl.rb +40 -33
- data/lib/vedeu/borders/null.rb +2 -2
- data/lib/vedeu/borders/render.rb +29 -24
- data/lib/vedeu/borders/repository.rb +2 -2
- data/lib/vedeu/buffers/all.rb +8 -7
- data/lib/vedeu/buffers/buffer.rb +47 -39
- data/lib/vedeu/buffers/null.rb +2 -2
- data/lib/vedeu/buffers/refresh.rb +4 -3
- data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
- data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
- data/lib/vedeu/colours/background.rb +2 -1
- data/lib/vedeu/colours/colour.rb +21 -19
- data/lib/vedeu/colours/foreground.rb +2 -1
- data/lib/vedeu/colours/repository.rb +6 -5
- data/lib/vedeu/colours/translator.rb +39 -35
- data/lib/vedeu/configuration/api.rb +59 -51
- data/lib/vedeu/configuration/cli.rb +9 -7
- data/lib/vedeu/configuration/configuration.rb +41 -32
- data/lib/vedeu/cursors/cursor.rb +1 -1
- data/lib/vedeu/cursors/refresh.rb +20 -16
- data/lib/vedeu/distributed/server.rb +8 -6
- data/lib/vedeu/distributed/subprocess.rb +90 -86
- data/lib/vedeu/distributed/uri.rb +4 -3
- data/lib/vedeu/dsl/composition.rb +2 -2
- data/lib/vedeu/dsl/group.rb +4 -4
- data/lib/vedeu/dsl/interface.rb +5 -5
- data/lib/vedeu/dsl/presentation.rb +2 -2
- data/lib/vedeu/dsl/text.rb +1 -1
- data/lib/vedeu/editor/cropper.rb +4 -4
- data/lib/vedeu/editor/cursor.rb +6 -4
- data/lib/vedeu/editor/document.rb +20 -18
- data/lib/vedeu/editor/editor.rb +2 -2
- data/lib/vedeu/editor/line.rb +10 -5
- data/lib/vedeu/editor/lines.rb +2 -2
- data/lib/vedeu/internal_api.rb +4 -4
- data/lib/vedeu/models/focus.rb +197 -191
- data/lib/vedeu/models/group.rb +171 -159
- data/lib/vedeu/models/groups.rb +14 -10
- data/lib/vedeu/models/interface.rb +116 -110
- data/lib/vedeu/models/interfaces.rb +24 -20
- data/lib/vedeu/models/toggleable.rb +4 -4
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/composition.rb +1 -1
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/stream.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/compressor.rb +78 -73
- data/lib/vedeu/output/direct.rb +61 -57
- data/lib/vedeu/output/output.rb +34 -29
- data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
- data/lib/vedeu/output/presentation/style.rb +64 -18
- data/lib/vedeu/output/presentation/styles.rb +39 -0
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/output/renderers/json.rb +2 -1
- data/lib/vedeu/output/renderers/terminal.rb +3 -3
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/text.rb +186 -180
- data/lib/vedeu/output/wordwrap.rb +142 -138
- data/lib/vedeu/refresh/refresh.rb +2 -2
- data/lib/vedeu/templating/helpers.rb +11 -6
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/render_test.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
- data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
- data/test/lib/vedeu/colours/colour_test.rb +4 -4
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +3 -3
- data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
- data/test/lib/vedeu/dsl/group_test.rb +3 -3
- data/test/lib/vedeu/dsl/interface_test.rb +6 -5
- data/test/lib/vedeu/dsl/line_test.rb +4 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
- data/test/lib/vedeu/dsl/text_test.rb +8 -8
- data/test/lib/vedeu/editor/document_test.rb +10 -6
- data/test/lib/vedeu/input/keymap_test.rb +1 -10
- data/test/lib/vedeu/models/focus_test.rb +177 -170
- data/test/lib/vedeu/models/group_test.rb +99 -95
- data/test/lib/vedeu/models/groups_test.rb +13 -9
- data/test/lib/vedeu/models/interface_test.rb +93 -87
- data/test/lib/vedeu/models/interfaces_test.rb +24 -20
- data/test/lib/vedeu/models/views/char_test.rb +2 -2
- data/test/lib/vedeu/models/views/line_test.rb +11 -7
- data/test/lib/vedeu/models/views/stream_test.rb +1 -1
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
- data/test/lib/vedeu/output/compressor_test.rb +126 -122
- data/test/lib/vedeu/output/direct_test.rb +49 -43
- data/test/lib/vedeu/output/output_test.rb +35 -31
- data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
- data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
- data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
- data/test/lib/vedeu/output/text_test.rb +109 -105
- data/test/lib/vedeu/output/viewport_test.rb +3 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
- data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/view_template_test.rb +1 -1
- metadata +17 -8
- data/lib/vedeu/output/style.rb +0 -76
- data/test/lib/vedeu/output/style_test.rb +0 -120
@@ -19,7 +19,9 @@ module Vedeu
|
|
19
19
|
end
|
20
20
|
}
|
21
21
|
let(:visible) { true }
|
22
|
-
let(:interface) {
|
22
|
+
let(:interface) {
|
23
|
+
Vedeu::Models::Interface.new(style: nil, visible: visible)
|
24
|
+
}
|
23
25
|
let(:geometry) { Vedeu::Geometry::Geometry.new(height: 3, width: 3) }
|
24
26
|
|
25
27
|
before do
|
@@ -2,107 +2,171 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
{
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
module Output
|
6
|
+
|
7
|
+
describe Wordwrap do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Output::Wordwrap }
|
10
|
+
let(:instance) { described.new(text, options) }
|
11
|
+
let(:text) { '' }
|
12
|
+
let(:options) {
|
13
|
+
{
|
14
|
+
ellipsis: '...',
|
15
|
+
mode: mode,
|
16
|
+
width: width,
|
17
|
+
}
|
18
|
+
}
|
19
|
+
let(:mode) { :default }
|
20
|
+
let(:width) { 30 }
|
21
|
+
|
22
|
+
let(:text_line) {
|
23
|
+
"Krypton (from Greek: κρυπτός kryptos 'the hidden one')."
|
24
|
+
}
|
25
|
+
let(:text_block) {
|
26
|
+
"Krypton (from Greek: κρυπτός kryptos 'the hidden one') is a " \
|
27
|
+
"chemical element with symbol Kr and atomic number 36. It is a " \
|
28
|
+
'member of group 18 (noble gases) elements.'
|
29
|
+
}
|
30
|
+
let(:text_newlines) {
|
31
|
+
"Krypton is a colorless, odorless, tasteless noble gas.\n" \
|
32
|
+
"It occurs in trace amounts in the atmosphere.\n" \
|
33
|
+
"It is isolated by fractionally distilling liquefied air.\n" \
|
34
|
+
"Krypton is often used with other rare gases in fluorescent lamps.\n"
|
35
|
+
}
|
36
|
+
let(:text_blanklines) {
|
37
|
+
"Krypton (from Greek: κρυπτός kryptos 'the hidden one').\n\n" \
|
38
|
+
"It is a chemical element with symbol Kr and atomic number 36.\n" \
|
39
|
+
"It is a member of group 18 (noble gases) elements.\n\n" \
|
40
|
+
'-- Wikipedia'
|
15
41
|
}
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
'
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
Vedeu::Views::Line.new(value: [
|
43
|
-
Vedeu::Views::Stream.new(
|
44
|
-
value: 'Krypton is a colorless, odorless, tasteless noble gas.'
|
45
|
-
)]),
|
46
|
-
Vedeu::Views::Line.new(value: [
|
47
|
-
Vedeu::Views::Stream.new(
|
48
|
-
value: 'It occurs in trace amounts in the atmosphere.'
|
49
|
-
)]),
|
50
|
-
Vedeu::Views::Line.new(value: [
|
51
|
-
Vedeu::Views::Stream.new(
|
52
|
-
value: 'It is isolated by fractionally distilling liquefied air.'
|
53
|
-
)]),
|
54
|
-
Vedeu::Views::Line.new(value: [
|
55
|
-
Vedeu::Views::Stream.new(
|
56
|
-
value: 'Krypton is often used with other rare gases in ' \
|
57
|
-
'fluorescent lamps.'
|
58
|
-
)])
|
59
|
-
]
|
60
|
-
}
|
61
|
-
|
62
|
-
describe '#initialize' do
|
63
|
-
it { instance.must_be_instance_of(described) }
|
64
|
-
it { instance.instance_variable_get('@text').must_equal(text) }
|
65
|
-
it { instance.instance_variable_get('@options').must_equal(options) }
|
66
|
-
end
|
67
|
-
|
68
|
-
describe '#content' do
|
69
|
-
it { instance.must_respond_to(:content) }
|
70
|
-
end
|
71
|
-
|
72
|
-
describe '#prune' do
|
73
|
-
let(:text) { text_line }
|
74
|
-
|
75
|
-
subject { instance.prune }
|
76
|
-
|
77
|
-
context 'when the text is <= the pruning width' do
|
78
|
-
let(:width) { 80 }
|
79
|
-
|
80
|
-
it { subject.must_be_instance_of(String) }
|
81
|
-
|
82
|
-
it { subject.must_equal(
|
83
|
-
"Krypton (from Greek: κρυπτός kryptos 'the hidden one')."
|
84
|
-
) }
|
42
|
+
let(:text_line_objects) {
|
43
|
+
[
|
44
|
+
Vedeu::Views::Line.new(value: [
|
45
|
+
Vedeu::Views::Stream.new(
|
46
|
+
value: 'Krypton is a colorless, odorless, tasteless noble gas.'
|
47
|
+
)]),
|
48
|
+
Vedeu::Views::Line.new(value: [
|
49
|
+
Vedeu::Views::Stream.new(
|
50
|
+
value: 'It occurs in trace amounts in the atmosphere.'
|
51
|
+
)]),
|
52
|
+
Vedeu::Views::Line.new(value: [
|
53
|
+
Vedeu::Views::Stream.new(
|
54
|
+
value: 'It is isolated by fractionally distilling liquefied air.'
|
55
|
+
)]),
|
56
|
+
Vedeu::Views::Line.new(value: [
|
57
|
+
Vedeu::Views::Stream.new(
|
58
|
+
value: 'Krypton is often used with other rare gases in ' \
|
59
|
+
'fluorescent lamps.'
|
60
|
+
)])
|
61
|
+
]
|
62
|
+
}
|
63
|
+
|
64
|
+
describe '#initialize' do
|
65
|
+
it { instance.must_be_instance_of(described) }
|
66
|
+
it { instance.instance_variable_get('@text').must_equal(text) }
|
67
|
+
it { instance.instance_variable_get('@options').must_equal(options) }
|
85
68
|
end
|
86
69
|
|
87
|
-
|
70
|
+
describe '#content' do
|
71
|
+
it { instance.must_respond_to(:content) }
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#prune' do
|
75
|
+
let(:text) { text_line }
|
76
|
+
|
77
|
+
subject { instance.prune }
|
78
|
+
|
79
|
+
context 'when the text is <= the pruning width' do
|
80
|
+
let(:width) { 80 }
|
81
|
+
|
82
|
+
it { subject.must_be_instance_of(String) }
|
83
|
+
|
84
|
+
it { subject.must_equal(
|
85
|
+
"Krypton (from Greek: κρυπτός kryptos 'the hidden one')."
|
86
|
+
) }
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when the text is > the pruning width' do
|
90
|
+
context 'with a single line of text' do
|
91
|
+
it { subject.must_equal('Krypton (from Greek: κρυπτός...') }
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'with a text block' do
|
95
|
+
let(:text) { text_block }
|
96
|
+
|
97
|
+
it { subject.must_equal('Krypton (from Greek: κρυπτός...') }
|
98
|
+
end
|
99
|
+
|
100
|
+
context 'with a text block containing newlines' do
|
101
|
+
let(:text) { text_newlines }
|
102
|
+
|
103
|
+
it { subject.must_equal([
|
104
|
+
'Krypton is a colorless, odor...',
|
105
|
+
'It occurs in trace amounts i...',
|
106
|
+
'It is isolated by fractional...',
|
107
|
+
'Krypton is often used with o...'
|
108
|
+
])
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'with a text block containing newlines and blank lines' do
|
113
|
+
let(:text) { text_blanklines }
|
114
|
+
|
115
|
+
it { subject.must_equal([
|
116
|
+
'Krypton (from Greek: κρυπτός...',
|
117
|
+
'',
|
118
|
+
'It is a chemical element wit...',
|
119
|
+
'It is a member of group 18 (...',
|
120
|
+
'',
|
121
|
+
'-- Wikipedia...'
|
122
|
+
])
|
123
|
+
}
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#wrap' do
|
129
|
+
subject { instance.wrap }
|
130
|
+
|
88
131
|
context 'with a single line of text' do
|
89
|
-
|
132
|
+
let(:text) { text_line }
|
133
|
+
|
134
|
+
it { subject.must_equal([
|
135
|
+
'Krypton (from Greek: κρυπτός',
|
136
|
+
"kryptos 'the hidden one')."
|
137
|
+
])
|
138
|
+
}
|
90
139
|
end
|
91
140
|
|
92
141
|
context 'with a text block' do
|
93
142
|
let(:text) { text_block }
|
94
143
|
|
95
|
-
it { subject.must_equal(
|
144
|
+
it { subject.must_equal([
|
145
|
+
'Krypton (from Greek: κρυπτός',
|
146
|
+
"kryptos 'the hidden one') is",
|
147
|
+
'a chemical element with',
|
148
|
+
'symbol Kr and atomic number',
|
149
|
+
'36. It is a member of group',
|
150
|
+
'18 (noble gases) elements.'
|
151
|
+
])
|
152
|
+
}
|
96
153
|
end
|
97
154
|
|
98
155
|
context 'with a text block containing newlines' do
|
99
156
|
let(:text) { text_newlines }
|
100
157
|
|
101
158
|
it { subject.must_equal([
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
159
|
+
'Krypton is a colorless,',
|
160
|
+
'odorless, tasteless noble',
|
161
|
+
'gas.',
|
162
|
+
'It occurs in trace amounts',
|
163
|
+
'in the atmosphere.',
|
164
|
+
'It is isolated by',
|
165
|
+
'fractionally distilling',
|
166
|
+
'liquefied air.',
|
167
|
+
'Krypton is often used with',
|
168
|
+
'other rare gases in',
|
169
|
+
'fluorescent lamps.'
|
106
170
|
])
|
107
171
|
}
|
108
172
|
end
|
@@ -111,114 +175,25 @@ module Vedeu
|
|
111
175
|
let(:text) { text_blanklines }
|
112
176
|
|
113
177
|
it { subject.must_equal([
|
114
|
-
'Krypton (from Greek:
|
178
|
+
'Krypton (from Greek: κρυπτός',
|
179
|
+
"kryptos 'the hidden one').",
|
115
180
|
'',
|
116
|
-
'It is a chemical element
|
117
|
-
'
|
181
|
+
'It is a chemical element',
|
182
|
+
'with symbol Kr and atomic',
|
183
|
+
'number 36.',
|
184
|
+
'It is a member of group 18',
|
185
|
+
'(noble gases) elements.',
|
118
186
|
'',
|
119
|
-
'-- Wikipedia
|
187
|
+
'-- Wikipedia'
|
120
188
|
])
|
121
189
|
}
|
122
190
|
end
|
123
191
|
end
|
124
|
-
end
|
125
192
|
|
126
|
-
|
127
|
-
|
193
|
+
describe '.for' do
|
194
|
+
subject { described.for(text, options) }
|
128
195
|
|
129
|
-
|
130
|
-
let(:text) { text_line }
|
131
|
-
|
132
|
-
it { subject.must_equal([
|
133
|
-
'Krypton (from Greek: κρυπτός',
|
134
|
-
"kryptos 'the hidden one')."
|
135
|
-
])
|
136
|
-
}
|
137
|
-
end
|
138
|
-
|
139
|
-
context 'with a text block' do
|
140
|
-
let(:text) { text_block }
|
141
|
-
|
142
|
-
it { subject.must_equal([
|
143
|
-
'Krypton (from Greek: κρυπτός',
|
144
|
-
"kryptos 'the hidden one') is",
|
145
|
-
'a chemical element with',
|
146
|
-
'symbol Kr and atomic number',
|
147
|
-
'36. It is a member of group',
|
148
|
-
'18 (noble gases) elements.'
|
149
|
-
])
|
150
|
-
}
|
151
|
-
end
|
152
|
-
|
153
|
-
context 'with a text block containing newlines' do
|
154
|
-
let(:text) { text_newlines }
|
155
|
-
|
156
|
-
it { subject.must_equal([
|
157
|
-
'Krypton is a colorless,',
|
158
|
-
'odorless, tasteless noble',
|
159
|
-
'gas.',
|
160
|
-
'It occurs in trace amounts',
|
161
|
-
'in the atmosphere.',
|
162
|
-
'It is isolated by',
|
163
|
-
'fractionally distilling',
|
164
|
-
'liquefied air.',
|
165
|
-
'Krypton is often used with',
|
166
|
-
'other rare gases in',
|
167
|
-
'fluorescent lamps.'
|
168
|
-
])
|
169
|
-
}
|
170
|
-
end
|
171
|
-
|
172
|
-
context 'with a text block containing newlines and blank lines' do
|
173
|
-
let(:text) { text_blanklines }
|
174
|
-
|
175
|
-
it { subject.must_equal([
|
176
|
-
'Krypton (from Greek: κρυπτός',
|
177
|
-
"kryptos 'the hidden one').",
|
178
|
-
'',
|
179
|
-
'It is a chemical element',
|
180
|
-
'with symbol Kr and atomic',
|
181
|
-
'number 36.',
|
182
|
-
'It is a member of group 18',
|
183
|
-
'(noble gases) elements.',
|
184
|
-
'',
|
185
|
-
'-- Wikipedia'
|
186
|
-
])
|
187
|
-
}
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe '.for' do
|
192
|
-
subject { described.for(text, options) }
|
193
|
-
|
194
|
-
it { subject.must_be_instance_of(Vedeu::Views::Lines) }
|
195
|
-
|
196
|
-
context 'with a single line of text' do
|
197
|
-
let(:text) { text_line }
|
198
|
-
|
199
|
-
it { subject.size.must_equal(1) }
|
200
|
-
end
|
201
|
-
|
202
|
-
context 'with a text block' do
|
203
|
-
let(:text) { text_block }
|
204
|
-
|
205
|
-
it { subject.size.must_equal(1) }
|
206
|
-
end
|
207
|
-
|
208
|
-
context 'with a text block containing newlines' do
|
209
|
-
let(:text) { text_newlines }
|
210
|
-
|
211
|
-
it { subject.size.must_equal(4) }
|
212
|
-
end
|
213
|
-
|
214
|
-
context 'with a text block containing newlines and blank lines' do
|
215
|
-
let(:text) { text_blanklines }
|
216
|
-
|
217
|
-
it { subject.size.must_equal(6) }
|
218
|
-
end
|
219
|
-
|
220
|
-
context 'when mode: :prune' do
|
221
|
-
let(:mode) { :prune }
|
196
|
+
it { subject.must_be_instance_of(Vedeu::Views::Lines) }
|
222
197
|
|
223
198
|
context 'with a single line of text' do
|
224
199
|
let(:text) { text_line }
|
@@ -243,37 +218,66 @@ module Vedeu
|
|
243
218
|
|
244
219
|
it { subject.size.must_equal(6) }
|
245
220
|
end
|
246
|
-
end
|
247
221
|
|
248
|
-
|
249
|
-
|
222
|
+
context 'when mode: :prune' do
|
223
|
+
let(:mode) { :prune }
|
250
224
|
|
251
|
-
|
252
|
-
|
225
|
+
context 'with a single line of text' do
|
226
|
+
let(:text) { text_line }
|
253
227
|
|
254
|
-
|
255
|
-
|
228
|
+
it { subject.size.must_equal(1) }
|
229
|
+
end
|
256
230
|
|
257
|
-
|
258
|
-
|
231
|
+
context 'with a text block' do
|
232
|
+
let(:text) { text_block }
|
259
233
|
|
260
|
-
|
261
|
-
|
234
|
+
it { subject.size.must_equal(1) }
|
235
|
+
end
|
262
236
|
|
263
|
-
|
264
|
-
|
237
|
+
context 'with a text block containing newlines' do
|
238
|
+
let(:text) { text_newlines }
|
239
|
+
|
240
|
+
it { subject.size.must_equal(4) }
|
241
|
+
end
|
242
|
+
|
243
|
+
context 'with a text block containing newlines and blank lines' do
|
244
|
+
let(:text) { text_blanklines }
|
265
245
|
|
266
|
-
|
246
|
+
it { subject.size.must_equal(6) }
|
247
|
+
end
|
267
248
|
end
|
268
249
|
|
269
|
-
context '
|
270
|
-
let(:
|
250
|
+
context 'when mode: :wrap' do
|
251
|
+
let(:mode) { :wrap }
|
252
|
+
|
253
|
+
context 'with a single line of text' do
|
254
|
+
let(:text) { text_line }
|
255
|
+
|
256
|
+
it { subject.size.must_equal(2) }
|
257
|
+
end
|
258
|
+
|
259
|
+
context 'with a text block' do
|
260
|
+
let(:text) { text_block }
|
271
261
|
|
272
|
-
|
262
|
+
it { subject.size.must_equal(6) }
|
263
|
+
end
|
264
|
+
|
265
|
+
context 'with a text block containing newlines' do
|
266
|
+
let(:text) { text_newlines }
|
267
|
+
|
268
|
+
it { subject.size.must_equal(11) }
|
269
|
+
end
|
270
|
+
|
271
|
+
context 'with a text block containing newlines and blank lines' do
|
272
|
+
let(:text) { text_blanklines }
|
273
|
+
|
274
|
+
it { subject.size.must_equal(10) }
|
275
|
+
end
|
273
276
|
end
|
274
277
|
end
|
275
|
-
end
|
276
278
|
|
277
|
-
|
279
|
+
end # Wordwrap
|
280
|
+
|
281
|
+
end # Output
|
278
282
|
|
279
283
|
end # Vedeu
|