Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed several failing tests due to platform-specific newline #1323

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public void testHiddenIdentifierFromReturn() throws IOException {
final Set<String> warningMessages =
warnings.stream().map(Throwable::getMessage).collect(Collectors.toSet());
assertThat(
warningMessages, contains("A let identifier [var] is hiding another identifier of the same name. \n"));
warningMessages,
contains(String.format("A let identifier [var] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -48,10 +49,10 @@ public void testHidingUnionWithSameAlias() throws IOException {

assertThat(distinct.size(), is(2));

final String first =
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead? \n";
final String second =
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead? \n";
final String first = String.format(
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead? %n");
final String second = String.format(
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead? %n");

assertThat(distinct.toString(), distinct, containsInAnyOrder(first, second));
}
Expand All @@ -73,11 +74,12 @@ public void testHidingUnionWithSameAliasEachHides() throws IOException {

assertThat(distinct.size(), is(3));

final String first =
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead? \n";
final String second =
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead? \n";
final String third = "An alias identifier [IWantToBeHidden] is hiding another identifier of the same name. \n";
final String first = String.format(
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead? %n");
final String second = String.format(
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead? %n");
final String third = String.format(
"An alias identifier [IWantToBeHidden] is hiding another identifier of the same name. %n");

assertThat(distinct.toString(), distinct, containsInAnyOrder(first, second, third));
}
Expand All @@ -100,8 +102,8 @@ public void testSoMuchNestingHidingSimple() throws IOException {
assertThat(warnings.toString(), translator.getWarnings().size(), is(1));
assertThat(
warnings.stream().map(Throwable::getMessage).collect(Collectors.toList()),
containsInAnyOrder(
"An alias identifier [SoMuchNesting] is hiding another identifier of the same name. \n"));
containsInAnyOrder(String.format(
"An alias identifier [SoMuchNesting] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -121,8 +123,10 @@ public void testSoMuchNestingHidingComplex() throws IOException {

assertThat(distinct.size(), is(2));

final String first = "An alias identifier [SoMuchNesting] is hiding another identifier of the same name. \n";
final String second = "A let identifier [SoMuchNesting] is hiding another identifier of the same name. \n";
final String first =
String.format("An alias identifier [SoMuchNesting] is hiding another identifier of the same name. %n");
final String second =
String.format("A let identifier [SoMuchNesting] is hiding another identifier of the same name. %n");

assertThat(distinct, containsInAnyOrder(first, second));
}
Expand All @@ -137,7 +141,8 @@ public void testHidingLetAlias() throws IOException {
assertThat(warningMessages.toString(), translator.getWarnings().size(), is(1));
assertThat(
warnings.stream().map(Throwable::getMessage).collect(Collectors.toList()),
containsInAnyOrder("A let identifier [Alias] is hiding another identifier of the same name. \n"));
containsInAnyOrder(
String.format("A let identifier [Alias] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -148,7 +153,8 @@ public void testHiddenIdentifierArgumentToAlias() throws IOException {
assertThat(translator.getWarnings().size(), is(1));
assertThat(
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList()),
contains("An alias identifier [testOperand] is hiding another identifier of the same name. \n"));
contains(String.format(
"An alias identifier [testOperand] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -168,7 +174,8 @@ public void testHidingFunctionDefinitionWithOverloads() throws IOException {
assertThat(warningMessages.toString(), warnings.size(), is(1));
assertThat(
warningMessages,
contains("An alias identifier [IWantToBeHidden] is hiding another identifier of the same name. \n"));
contains(String.format(
"An alias identifier [IWantToBeHidden] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -181,7 +188,8 @@ public void testHidingParameterDefinition() throws IOException {
assertThat(warningMessages.toString(), warnings.size(), is(1));
assertThat(
warningMessages,
contains("An alias identifier [Measurement Period] is hiding another identifier of the same name. \n"));
contains(String.format(
"An alias identifier [Measurement Period] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -194,7 +202,8 @@ public void testHidingIncludeDefinition() throws IOException {
assertThat(warningMessages.toString(), warnings.size(), is(1));
assertThat(
warningMessages,
contains("An alias identifier [FHIRHelpers] is hiding another identifier of the same name. \n"));
contains(String.format(
"An alias identifier [FHIRHelpers] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -210,7 +219,7 @@ public void testHidingCommaMissingInListConstruction() throws IOException {
assertThat(distinctWarningMessages.toString(), distinctWarningMessages.size(), is(1));
assertThat(
distinctWarningMessages,
contains("An alias identifier [5] is hiding another identifier of the same name. \n"));
contains(String.format("An alias identifier [5] is hiding another identifier of the same name. %n")));
}

@Test
Expand All @@ -225,10 +234,10 @@ public void testHidingStringLiteral() throws IOException {
warningMessages.stream().distinct().collect(Collectors.toList());
assertThat(distinctWarningMessages.toString(), distinctWarningMessages.size(), is(2));

final String stringLiteralIWantToBeHidden =
"You used a string literal: [IWantToBeHidden] here that matches an identifier in scope: [IWantToBeHidden]. Did you mean to use the identifier instead? \n";
final String stringLiteralIWantToHide =
"You used a string literal: [IWantToHide] here that matches an identifier in scope: [IWantToHide]. Did you mean to use the identifier instead? \n";
final String stringLiteralIWantToBeHidden = String.format(
"You used a string literal: [IWantToBeHidden] here that matches an identifier in scope: [IWantToBeHidden]. Did you mean to use the identifier instead? %n");
final String stringLiteralIWantToHide = String.format(
"You used a string literal: [IWantToHide] here that matches an identifier in scope: [IWantToHide]. Did you mean to use the identifier instead? %n");
assertThat(distinctWarningMessages, containsInAnyOrder(stringLiteralIWantToBeHidden, stringLiteralIWantToHide));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,21 +353,27 @@ public void testHidingVariousUseCases() throws IOException {
assertThat(warningMessages.toString(), distinct.size(), is(11));

final String hidingDefinition =
"An alias identifier [Definition] is hiding another identifier of the same name. \n";
final String hidingVarLet = "A let identifier [var] is hiding another identifier of the same name. \n";
String.format("An alias identifier [Definition] is hiding another identifier of the same name. %n");
final String hidingVarLet =
String.format("A let identifier [var] is hiding another identifier of the same name. %n");
final String hidingContextValueSet =
"An alias identifier [ValueSet] is hiding another identifier of the same name. \n";
String.format("An alias identifier [ValueSet] is hiding another identifier of the same name. %n");
final String hidingLetValueSet =
"A let identifier [ValueSet] is hiding another identifier of the same name. \n";
final String hidingContextCode = "An alias identifier [Code] is hiding another identifier of the same name. \n";
final String hidingLetCode = "A let identifier [Code] is hiding another identifier of the same name. \n";
String.format("A let identifier [ValueSet] is hiding another identifier of the same name. %n");
final String hidingContextCode =
String.format("An alias identifier [Code] is hiding another identifier of the same name. %n");
final String hidingLetCode =
String.format("A let identifier [Code] is hiding another identifier of the same name. %n");
final String hidingContextCodeSystem =
"An alias identifier [CodeSystem] is hiding another identifier of the same name. \n";
String.format("An alias identifier [CodeSystem] is hiding another identifier of the same name. %n");
final String hidingLetCodeSystem =
"A let identifier [CodeSystem] is hiding another identifier of the same name. \n";
final String hidingContextFhir = "An alias identifier [FHIR] is hiding another identifier of the same name. \n";
final String hidingLetFhir = "A let identifier [FHIR] is hiding another identifier of the same name. \n";
final String hidingAliasLet = "A let identifier [Alias] is hiding another identifier of the same name. \n";
String.format("A let identifier [CodeSystem] is hiding another identifier of the same name. %n");
final String hidingContextFhir =
String.format("An alias identifier [FHIR] is hiding another identifier of the same name. %n");
final String hidingLetFhir =
String.format("A let identifier [FHIR] is hiding another identifier of the same name. %n");
final String hidingAliasLet =
String.format("A let identifier [Alias] is hiding another identifier of the same name. %n");

assertThat(
distinct,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,8 @@ public void testOverload() throws IOException {
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList());
assertThat(warningMessages.toString(), translator.getWarnings().size(), is(2));

final String first =
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? \n";
final String first = String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n");
final String second =
"The function TestOverload.Stringify has multiple overloads and due to the SignatureLevel setting (None), the overload signature is not being included in the output. This may result in ambiguous function resolution at runtime, consider setting the SignatureLevel to Overloads or All to ensure that the output includes sufficient information to support correct overload selection at runtime.";

Expand All @@ -871,7 +871,8 @@ public void testOverloadOutput() throws IOException {
warningMessages.toString(),
warningMessages,
contains(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? \n"));
String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n")));
}

@Test
Expand All @@ -883,8 +884,8 @@ public void testOverloadForward() throws IOException {
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList());
assertThat(warningMessages.toString(), translator.getWarnings().size(), is(2));

final String first =
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? \n";
final String first = String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n");
final String second =
"The function TestOverloadForward.Stringify has multiple overloads and due to the SignatureLevel setting (None), the overload signature is not being included in the output. This may result in ambiguous function resolution at runtime, consider setting the SignatureLevel to Overloads or All to ensure that the output includes sufficient information to support correct overload selection at runtime.";

Expand All @@ -903,6 +904,7 @@ public void testOverloadForwardOutput() throws IOException {
warningMessages.toString(),
warningMessages,
contains(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? \n"));
String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public void testAuthoringPatterns() throws IOException {

assertThat(translator.getWarnings().toString(), translator.getWarnings().size(), is(1));

final String first = "An alias identifier [Diabetes] is hiding another identifier of the same name. \n";
final String first =
String.format("An alias identifier [Diabetes] is hiding another identifier of the same name. %n");

assertThat(
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public void testAuthoringPatterns() throws IOException {

assertThat(translator.getWarnings().toString(), translator.getWarnings().size(), is(1));

final String first = "An alias identifier [Diabetes] is hiding another identifier of the same name. \n";
final String first =
String.format("An alias identifier [Diabetes] is hiding another identifier of the same name. %n");

assertThat(
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList()),
Expand Down
Loading