Skip to content

Commit

Permalink
Add tests for member access on empty sequence types
Browse files Browse the repository at this point in the history
  • Loading branch information
MaryamZi committed Sep 26, 2024
1 parent f11a4b4 commit 2f37ab3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void testNegativeCases() {
"found '(xml:Element|xml:Comment|xml<never>)'", 74, 32);
validateError(negativeResult, i++, "incompatible types: expected '(xml:Comment|xml<never>)', " +
"found '(xml:Comment|xml:ProcessingInstruction|never|xml<never>)'", 77, 32);
validateError(negativeResult, i++, "incompatible types: expected 'xml:Element', found 'xml<never>'", 82, 21);
Assert.assertEquals(negativeResult.getErrorCount(), i);
}

Expand All @@ -104,7 +105,8 @@ public Object[][] xmlMemberAccessFunctions() {
{ "testXmlMemberAccessOnXmlProcessingInstructionSequences" },
{ "testXmlMemberAccessOnXmlSingletons" },
{ "testXmlMemberAccessOnXmlUnions" },
{ "testXmlMemberAccessOnXmlUnionSequences" }
{ "testXmlMemberAccessOnXmlUnionSequences" },
{ "testXmlMemberAccessOnEmptySequenceType" }
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ function testXmlMemberAccessOnXmlUnionSequences() {
assertTrue(seq2[1] is xml<never>);
}

function testXmlMemberAccessOnEmptySequenceType() {
xml<never> seq = xml ``;
xml<never> val = seq[0];
assertEquality(xml ``, val);
}

function assertTrue(anydata actual) {
assertEquality(true, actual);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ function testXmlMemberAccessOnXmlUnionSequencesNegative() {
xml<xml:Comment|xml:ProcessingInstruction|never> seq2 = xml `<?pi val?>`;
xml:Comment|xml<never> _ = seq2[0];
}

function testXmlMemberAccessOnEmptySequenceTypeNegative() {
xml<never> seq = xml ``;
xml:Element _ = seq[0];
}

0 comments on commit 2f37ab3

Please sign in to comment.