macros4cuke 0.3.18 → 0.3.19
Sign up to get free protection for your applications and to get access to all the features.
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +9 -2
- data/lib/macros4cuke/constants.rb +1 -1
- data/lib/macros4cuke/exceptions.rb +0 -3
- data/lib/macros4cuke/templating/engine.rb +32 -21
- metadata +2 -2
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
+
## 0.3.19 / 2013-05-22
|
2
|
+
* [CHANGE] File `.rubocop.yml`: Reduced MethodLength to 30 (lines in a method).
|
3
|
+
* [CHANGE] Method `Engine#compile_line refactored: Extract Method pattern => new method line_rep_ending added.
|
4
|
+
* [CHANGE] Method `Engine#compile_sections refactored: Extract Method pattern => new method validate_section_end added.
|
5
|
+
* [FIX] File `exceptions.rb`: Removal of useless assignment (detected by Rubocop). No runtime impact.
|
6
|
+
|
7
|
+
|
1
8
|
## 0.3.18 / 2013-05-21
|
2
9
|
* [FEATURE] Support for sub-steps having multiline text arguments (docstring).
|
3
|
-
* [CHANGE] Method MacroStep#expand passes also built-in arguments to template engine.
|
4
|
-
* [CHANGE] Method MacroStep#validate_phrase_args does not apply validations on built-in arguments.
|
10
|
+
* [CHANGE] Method `MacroStep#expand passes` also built-in arguments to template engine.
|
11
|
+
* [CHANGE] Method `MacroStep#validate_phrase_args` does not apply validations on built-in arguments.
|
5
12
|
* [CHANGE] File `macro-step_spec.rb`: Added one example to test the insertion of triple quotes.
|
6
13
|
* [NEW] File `multiline.feature` added in examples/features/ folder.
|
7
14
|
* [CHANGE] File `README.md`: Added section 'Sub-steps with multiline text argument'
|
@@ -394,20 +394,25 @@ private
|
|
394
394
|
if line_to_squeeze && ! section_item.nil?
|
395
395
|
line_rep = [section_item]
|
396
396
|
else
|
397
|
-
|
398
|
-
# then place eoline before that item.
|
399
|
-
# Otherwise, end the line with a eoline marker.
|
400
|
-
if line_rep.last.is_a?(SectionEndMarker)
|
401
|
-
section_end = line_rep.pop()
|
402
|
-
line_rep << EOLine.new
|
403
|
-
line_rep << section_end
|
404
|
-
else
|
405
|
-
line_rep << EOLine.new
|
406
|
-
end
|
397
|
+
line_rep_ending(line_rep)
|
407
398
|
end
|
408
399
|
|
409
400
|
return line_rep
|
410
401
|
end
|
402
|
+
|
403
|
+
|
404
|
+
# Apply rule: if last item in line is an end of section marker,
|
405
|
+
# then place eoline before that item.
|
406
|
+
# Otherwise, end the line with a eoline marker.
|
407
|
+
def line_rep_ending(theLineRep)
|
408
|
+
if theLineRep.last.is_a?(SectionEndMarker)
|
409
|
+
section_end = theLineRep.pop()
|
410
|
+
theLineRep << EOLine.new
|
411
|
+
theLineRep << section_end
|
412
|
+
else
|
413
|
+
theLineRep << EOLine.new
|
414
|
+
end
|
415
|
+
end
|
411
416
|
|
412
417
|
|
413
418
|
# @param aCouple [Array] a two-element array of the form: [kind, text]
|
@@ -461,24 +466,18 @@ private
|
|
461
466
|
when Section
|
462
467
|
open_sections << element
|
463
468
|
|
464
|
-
when SectionEndMarker
|
465
|
-
|
466
|
-
raise StandardError, "End of section</#{element.name}> found while no corresponding section is open."
|
467
|
-
end
|
468
|
-
if element.name != open_sections.last.name
|
469
|
-
msg = "End of section</#{element.name}> doesn't match current section '#{open_sections.last.name}'."
|
470
|
-
raise StandardError, msg
|
471
|
-
end
|
469
|
+
when SectionEndMarker
|
470
|
+
validate_section_end(element, open_sections)
|
472
471
|
subResult << open_sections.pop()
|
473
|
-
|
472
|
+
|
474
473
|
else
|
475
474
|
if open_sections.empty?
|
476
475
|
subResult << element
|
477
476
|
else
|
478
477
|
open_sections.last.add_child(element)
|
479
478
|
end
|
480
|
-
|
481
|
-
|
479
|
+
|
480
|
+
end
|
482
481
|
end
|
483
482
|
|
484
483
|
unless open_sections.empty?
|
@@ -488,6 +487,18 @@ private
|
|
488
487
|
|
489
488
|
return compiled
|
490
489
|
end
|
490
|
+
|
491
|
+
# Validate the given end of section marker taking into account the open sections.
|
492
|
+
def validate_section_end(marker, sections)
|
493
|
+
if sections.empty?
|
494
|
+
msg = "End of section</#{marker.name}> found while no corresponding section is open."
|
495
|
+
raise StandardError, msg
|
496
|
+
end
|
497
|
+
if marker.name != sections.last.name
|
498
|
+
msg = "End of section</#{marker.name}> doesn't match current section '#{sections.last.name}'."
|
499
|
+
raise StandardError, msg
|
500
|
+
end
|
501
|
+
end
|
491
502
|
|
492
503
|
end # class
|
493
504
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macros4cuke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|