Skip to content

Commit

Permalink
Add a test to validate that the default context is Unfiltered
Browse files Browse the repository at this point in the history
  • Loading branch information
JPercival committed Jan 6, 2024
1 parent 66f4174 commit aed32b8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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.*;
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit aed32b8

Please sign in to comment.