File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
main/java/org/jbehave/core/parsers
test/java/org/jbehave/core/parsers Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -402,9 +402,8 @@ private Pattern findingScenarioTitle() {
402
402
403
403
private Pattern findingScenarioMeta () {
404
404
String startingWords = concatenateStartingWords ();
405
- return compile (
406
- ".*" + keywords ().meta () + "(.*?)\\ s*(" + keywords ().givenStories () + "|" + startingWords + "|$).*" ,
407
- DOTALL );
405
+ return compile (".*^\\ s*" + keywords ().meta () + "(.*?)\\ s*(" + keywords ().givenStories () + "|" + startingWords
406
+ + "|$).*" , DOTALL );
408
407
}
409
408
410
409
private Pattern findingScenarioGivenStories () {
Original file line number Diff line number Diff line change @@ -305,7 +305,29 @@ void shouldParseStoryWithScenarioTitleGivenStoriesAndStepsContainingKeywordsNotA
305
305
+ NL + "|Dado que|Quando|Então|E|"
306
306
+ NL ));
307
307
}
308
-
308
+
309
+ @ Test
310
+ void shouldNotParseExamplesTableMetaAsScenarioMeta () {
311
+ String wholeStory = "Scenario: Scenario with examples table containing meta"
312
+ + NL + "Given a scenario Given"
313
+ + NL + "Examples:"
314
+ + NL + "|Meta: |value|"
315
+ + NL + "|@number 1|one |"
316
+ + NL + "|@number 2|two |" + NL ;
317
+ Story story = parser .parseStory (wholeStory , storyPath );
318
+
319
+ Scenario scenario = story .getScenarios ().get (0 );
320
+ assertThat (scenario .getTitle (), equalTo ("Scenario with examples table containing meta" ));
321
+ List <String > steps = scenario .getSteps ();
322
+ assertThat (steps .get (0 ), equalTo ("Given a scenario Given" ));
323
+ assertThat (scenario .getExamplesTable ().asString (),
324
+ equalTo ("|Meta:|value|"
325
+ + NL + "|@number 1|one|"
326
+ + NL + "|@number 2|two|"
327
+ + NL ));
328
+ assertThat (scenario .getMeta ().isEmpty (), is (true ));
329
+ }
330
+
309
331
@ Test
310
332
void shouldParseStoryWithLifecycle () {
311
333
String wholeStory = "Lifecycle: "
You can’t perform that action at this time.
0 commit comments