From c8ef3e34ffac73e7f5d43ee71e1491abb76c61cf Mon Sep 17 00:00:00 2001 From: Sylvain Carisey Date: Wed, 6 Nov 2024 17:33:33 +0100 Subject: [PATCH] fix:regression on assert == step definition Signed-off-by: Sylvain Carisey --- .../com/lectra/kapoeira/glue/FeaturesStepDefinitions.scala | 2 +- src/test/resources/features/assertions.feature | 2 ++ src/test/resources/features/records/keyheadersvalue.dat | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/lectra/kapoeira/glue/FeaturesStepDefinitions.scala b/src/main/scala/com/lectra/kapoeira/glue/FeaturesStepDefinitions.scala index 19e0176..b73cfd9 100644 --- a/src/main/scala/com/lectra/kapoeira/glue/FeaturesStepDefinitions.scala +++ b/src/main/scala/com/lectra/kapoeira/glue/FeaturesStepDefinitions.scala @@ -176,7 +176,7 @@ class FeaturesStepDefinitions } // ASSERT - And("^assert\\s+(\\S+)\\s+(\\S+)\\s*==\\s*([^+-]*)\\s*$") { + And("""^assert\s+(\S+)\s+(\S+)\s*==(?!\s+(?:[+-.eE0-9]+)\s+\+\-\s+(?:[+-.eE0-9]+)\s*)(?:\s*)(.*)(?:\s*)$""") { (alias: String, jsonExpression: String, expected: String) => logger.debug( s"Assert Step : (alias,jsonExpression,expected) ($alias,$jsonExpression,$expected)" diff --git a/src/test/resources/features/assertions.feature b/src/test/resources/features/assertions.feature index d78bc04..e66cbba 100644 --- a/src/test/resources/features/assertions.feature +++ b/src/test/resources/features/assertions.feature @@ -24,6 +24,8 @@ Feature: assertions And assert value2.2 $ has size 2 And assert value2.2 $ == [3,4] And assert value2.3 $ == "value2.3" + And assert value2.4 $.bar == "2020-09-09T10:49:25.871365100" + And assert value2.4 $.baz == "42.0 +- 0.1" And assert value2.4 $.foo == 12.0038209653823934567890123456789 And assert value2.4 $.foo == 12.0 +- 0.1 And assert value2.4 $.foo == 12.1 +- 0.1 diff --git a/src/test/resources/features/records/keyheadersvalue.dat b/src/test/resources/features/records/keyheadersvalue.dat index b43e52f..17b2812 100644 --- a/src/test/resources/features/records/keyheadersvalue.dat +++ b/src/test/resources/features/records/keyheadersvalue.dat @@ -1,4 +1,4 @@ key1_${uuid}#{"qux":42}#{"foo":"bar","baz":42} key2_${uuid}#[3,4]#{"foo":"bar","baz":[1,2]} key3_${uuid}#value2.3#{"foo":"bar"} -key4_${uuid}#{"foo":12.0038209653823934567890123456789}#{"foo":"bar"} +key4_${uuid}#{"foo":12.0038209653823934567890123456789,"bar":"2020-09-09T10:49:25.871365100","baz":"42.0 +- 0.1"}#{"foo":"bar"}