dev-java/gson: improved test patch in 2.10.2_pre20231128

Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
This commit is contained in:
Miroslav Šulc
2023-12-06 10:33:28 +01:00
parent f0ae700713
commit 58cc509cc7
@@ -1,40 +1,13 @@
There were 2 failures:
1) testAssertionErrorInDeserializationPrintsVersion(com.google.gson.functional.GsonVersionDiagnosticsTest)
expected to match: (\(GSON \d\.\d+\.\d)(?:[-.][A-Z]+)?\)$
but was : (GSON 2.10.2_pre20231128)
at com.google.gson.functional.GsonVersionDiagnosticsTest.ensureAssertionErrorPrintsGsonVersion(GsonVersionDiagnosticsTest.java:91)
at com.google.gson.functional.GsonVersionDiagnosticsTest.testAssertionErrorInDeserializationPrintsVersion(GsonVersionDiagnosticsTest.java:79)
2) testAssertionErrorInSerializationPrintsVersion(com.google.gson.functional.GsonVersionDiagnosticsTest)
expected to match: (\(GSON \d\.\d+\.\d)(?:[-.][A-Z]+)?\)$
but was : (GSON 2.10.2_pre20231128)
at com.google.gson.functional.GsonVersionDiagnosticsTest.ensureAssertionErrorPrintsGsonVersion(GsonVersionDiagnosticsTest.java:91)
at com.google.gson.functional.GsonVersionDiagnosticsTest.testAssertionErrorInSerializationPrintsVersion(GsonVersionDiagnosticsTest.java:71)
support our versioning schemes
FAILURES!!!
Tests run: 1335, Failures: 2
--- a/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
+++ b/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
@@ -26,6 +26,7 @@ import com.google.gson.stream.JsonWriter;
import java.util.regex.Pattern;
import org.junit.Before;
import org.junit.Test;
+import org.junit.Ignore;
@@ -35,7 +35,7 @@ import org.junit.Test;
public class GsonVersionDiagnosticsTest {
// We require a patch number, even if it is .0, consistent with https://semver.org/#spec-item-2.
private static final Pattern GSON_VERSION_PATTERN =
- Pattern.compile("(\\(GSON \\d\\.\\d+\\.\\d)(?:[-.][A-Z]+)?\\)$");
+ Pattern.compile("(\\(GSON \\d\\.\\d+\\.\\d)(?:[-.][A-Z]+|_[a-z]+[0-9]+)?\\)$");
/**
* Functional tests to validate printing of Gson version on AssertionErrors
@@ -65,13 +66,13 @@ public class GsonVersionDiagnosticsTest {
assertThat("(GSON 2.8.5-SNAPSHOT)").matches(GSON_VERSION_PATTERN);
}
private Gson gson;
- @Test
+ @Test @Ignore
public void testAssertionErrorInSerializationPrintsVersion() {
AssertionError e = assertThrows(AssertionError.class, () -> gson.toJson(new TestType()));
ensureAssertionErrorPrintsGsonVersion(e);
}
- @Test
+ @Test @Ignore
public void testAssertionErrorInDeserializationPrintsVersion() {
AssertionError e =
assertThrows(AssertionError.class, () -> gson.fromJson("{'a':'abc'}", TestType.class));