From 45ae79f4defd3df5acb7b9701e8335d86625bd4b Mon Sep 17 00:00:00 2001 From: "Westerlaken, H.L. (Laurens)" Date: Mon, 11 Dec 2023 15:36:21 +0100 Subject: [PATCH 1/3] Add testcase --- .../test/java/org/openrewrite/yaml/YamlParserTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java b/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java index 1daf691cbc0..158186cfa8b 100644 --- a/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java +++ b/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java @@ -129,4 +129,14 @@ void unicodeEscapes() { ) ); } + + @Test + void projectBasedir() { + rewriteRun( + yaml( + """ + server: + keyStore: file:@project.basedir@/src/test/resources/keystore.jks + """)); + } } From 5f9ceeeef3c21e07b330e505b2292a64774a4165 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 11 Dec 2023 17:22:19 +0100 Subject: [PATCH 2/3] Apply suggestions from code review --- .../org/openrewrite/yaml/YamlParserTest.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java b/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java index 158186cfa8b..bf6d7a6e1b0 100644 --- a/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java +++ b/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java @@ -130,13 +130,19 @@ void unicodeEscapes() { ); } - @Test - void projectBasedir() { - rewriteRun( - yaml( - """ - server: - keyStore: file:@project.basedir@/src/test/resources/keystore.jks - """)); + @ParameterizedTest + @ValueSource(strings = { + // pass + "a: b", + "a: b:@d", + "a: b@@d", + "a: b@c@d", + "a: b:@@d", + // fail + "a: b:@c@d", + "a: 'b:@c@d'", + }) + void projectBasedir(String yaml) { + rewriteRun(yaml(yaml)); } } From 9d344c382c4664a0615a1a3536a731b356921ad2 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Fri, 16 Aug 2024 18:59:36 +0200 Subject: [PATCH 3/3] Show absolute minimal values for failure --- .../java/org/openrewrite/yaml/YamlParserTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java b/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java index 7fd93e86b44..e5919ea2f63 100644 --- a/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java +++ b/rewrite-yaml/src/test/java/org/openrewrite/yaml/YamlParserTest.java @@ -172,14 +172,13 @@ void unicodeEscapes() { @ParameterizedTest @ValueSource(strings = { // pass - "a: b", - "a: b:@d", - "a: b@@d", + "a: b@@c", "a: b@c@d", - "a: b:@@d", + "a: :@b", + "a: :@@b", // fail - "a: b:@c@d", - "a: 'b:@c@d'", + "a: :@b@", + "a: ':@b@'", }) void projectBasedir(String yaml) { rewriteRun(yaml(yaml));