Skip to content

Commit

Permalink
Minor change in error message for invalid compatibility version
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Mar 29, 2022
1 parent 5c170bf commit b3df453
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions compiler/core/src/zserio/ast/CompatibilityVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public CompatibilityVersion(AstLocation location, String versionStringLiteral, L
if (version.compareTo(CURRENT_ZSERIO_VERSION) > 0)
{
throw new ParserException(location,
"Root package specifies compatibility version '" + version + "' " +
"Package specifies compatibility version '" + version + "' " +
"which is higher than current zserio version '" + CURRENT_ZSERIO_VERSION + "'!");
}

if (version.compareTo(MINIMUM_SUPPORTED_VERSION) < 0)
{
throw new ParserException(location,
"Root package specifies unsupported compatibility version '" + version +
"Package specifies unsupported compatibility version '" + version +
"', minimum supported version is '" + MINIMUM_SUPPORTED_VERSION + "'!");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public boolean traverseTemplateInstantiations()
public void beginRoot(Root root) throws ZserioExtensionException
{
compatibilityVersion = root.getRootPackage().getCompatibilityVersion();
if (compatibilityVersion == null)
return;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions compiler/core/test/zserio/ast/CompatibilityVersionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void versionLessThanMinimiumSupported()
final ParserException exception = assertThrows(ParserException.class, () ->
new CompatibilityVersion(new AstLocation(null), "\"2.3.0\"", new ArrayList<DocComment>()));
assertThat(exception.getMessage(), containsString(
"Root package specifies unsupported compatibility version '2.3.0', minimum supported "));
"Package specifies unsupported compatibility version '2.3.0', minimum supported "));
}

@Test
Expand All @@ -31,7 +31,7 @@ public void versionHigherThanCurrentVersion()
new CompatibilityVersion(
new AstLocation(null), "\"" + higherVersion + "\"", new ArrayList<DocComment>()));
assertThat(exception.getMessage(), containsString(
"Root package specifies compatibility version '" + higherVersion + "' " +
"Package specifies compatibility version '" + higherVersion + "' " +
"which is higher than current zserio version '" + ZserioVersion.VERSION_STRING + "'!"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TEST_F(CompatibilityErrorTest, versionLessThanMinSupported)
{
ASSERT_TRUE(zserioErrors.isPresent(
"version_less_than_min_supported_error.zs:1:30: "
"Root package specifies unsupported compatibility version '2.3.2', "
"Package specifies unsupported compatibility version '2.3.2', "
"minimum supported version is '2.4.0'!"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void packedUInt32Array241()
public void versionLessThanMinSupported()
{
final String error = "version_less_than_min_supported_error.zs:1:30: " +
"Root package specifies unsupported compatibility version '2.3.2', " +
"Package specifies unsupported compatibility version '2.3.2', " +
"minimum supported version is '2.4.0'!";
assertTrue(zserioErrors.isPresent(error));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def testVersionLessThanMinSupported(self):
assertErrorsPresent(self,
"version_less_than_min_supported_error.zs",
[
":1:30: Root package specifies unsupported compatibility version '2.3.2', " +
":1:30: Package specifies unsupported compatibility version '2.3.2', " +
"minimum supported version is '2.4.0'!"
]
)
Expand Down

0 comments on commit b3df453

Please sign in to comment.