diff --git a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java b/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java index bc24187e9..be7df979f 100644 --- a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java +++ b/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java @@ -1,5 +1,8 @@ package org.cqframework.cql.cql2elm; +import static org.cqframework.cql.cql2elm.CqlCompilerOptions.Options.EnableAnnotations; +import static org.cqframework.cql.cql2elm.CqlCompilerOptions.Options.EnableDetailedErrors; +import static org.cqframework.cql.cql2elm.CqlCompilerOptions.Options.EnableResultTypes; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; @@ -173,6 +176,18 @@ public void testNoImplicitCasts() throws IOException { assertThat(as.getAsTypeSpecifier(), is(instanceOf(ChoiceTypeSpecifier.class))); } + @Test + // test for https://github.com/cqframework/clinical_quality_language/issues/1293 + public void defaultContextIsUnfiltered() throws IOException { + CqlTranslator translator = TestUtils.createTranslator( + "DefaultContext.cql", EnableAnnotations, EnableResultTypes, EnableDetailedErrors); + assertEquals(0, translator.getErrors().size()); + Library library = translator.getTranslatedLibrary().getLibrary(); + assertThat(library.getStatements().getDef().size(), is(2)); + var def = library.getStatements().getDef().get(0); + assertThat(def.getContext(), is("Unfiltered")); + } + @Test public void tenDividedByTwo() throws IOException { final CqlTranslator translator = TestUtils.createTranslator("TenDividedByTwo.cql"); diff --git a/Src/java/cql-to-elm/src/test/resources/org/cqframework/cql/cql2elm/DefaultContext.cql b/Src/java/cql-to-elm/src/test/resources/org/cqframework/cql/cql2elm/DefaultContext.cql new file mode 100644 index 000000000..323c2c2c0 --- /dev/null +++ b/Src/java/cql-to-elm/src/test/resources/org/cqframework/cql/cql2elm/DefaultContext.cql @@ -0,0 +1,7 @@ +// test for https://github.com/cqframework/clinical_quality_language/issues/1293 +library DefaultContext + +define "AbsNull Input": + Abs(null as Integer) +define "AbsNull Output": + null \ No newline at end of file