Skip to content

Commit

Permalink
Copy branch with hidden identifier checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukedegruchy committed Oct 31, 2023
1 parent 5989c06 commit 8c709bf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class SemanticTests {

Expand Down Expand Up @@ -635,6 +638,26 @@ public void TestQuotedForwards() throws IOException {
CqlTranslator translator = TestUtils.runSemanticTest("TestQuotedForwards.cql", 0);
}

@Test
public void testIncorrectParameterType1204() throws IOException {
final CqlTranslator translator = runSemanticTest("TestIncorrectParameterType1204.cql", 2);

final java.util.List<CqlCompilerException> errors = translator.getErrors();

assertTrue(errors.stream().map(Throwable::getMessage).collect(Collectors.toSet()).toString(), errors.stream().map(Throwable::getMessage).anyMatch("Could not find type for model: null and name: ThisTypeDoesNotExist"::equals));
}

@Test
public void testIdentifierCaseMismatch598() throws IOException {
// LUKETODO: Try this with both case sensitive and case insensitive configs
// LUKETODO: Try the opposite as well, lowercase when we expect capital
final CqlTranslator translator = runSemanticTest("TestIdentifierCaseMismatch598.cql", 2);

final List<CqlCompilerException> errors = translator.getErrors();

assertTrue(errors.stream().map(Throwable::getMessage).collect(Collectors.toSet()).toString(), errors.stream().map(Throwable::getMessage).anyMatch("Invalid case for library: FHIR and Code (should be code)"::equals));
}

private CqlTranslator runSemanticTest(String testFileName) throws IOException {
return runSemanticTest(testFileName, 0);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
library TestIdentifierCaseMismatch

using FHIR version '4.0.1'

// FHIR.Code is wrong: it should be FHIR.code
define function badFuncOne(value FHIR.Code) : null
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
@issue: [1204](https://github.com/cqframework/clinical_quality_language/issues/1204)
*/
library TestQuotedForwards

using FHIR version '4.0.1'

define function badFuncOne(value ThisTypeDoesNotExist) : null

0 comments on commit 8c709bf

Please sign in to comment.