@@ -18,14 +18,14 @@ import (
1818 "github.com/google/go-cmp/cmp"
1919 "github.com/google/go-cmp/cmp/cmpopts"
2020 "github.com/shopspring/decimal"
21- "github.com/verily-src/fhirpath-go/internal/fhir"
22- "github.com/verily-src/fhirpath-go/internal/element/extension"
23- "github.com/verily-src/fhirpath-go/internal/element/reference"
24- "github.com/verily-src/fhirpath-go/internal/fhirconv"
2521 "github.com/verily-src/fhirpath-go/fhirpath"
2622 "github.com/verily-src/fhirpath-go/fhirpath/compopts"
2723 "github.com/verily-src/fhirpath-go/fhirpath/evalopts"
2824 "github.com/verily-src/fhirpath-go/fhirpath/system"
25+ "github.com/verily-src/fhirpath-go/internal/element/extension"
26+ "github.com/verily-src/fhirpath-go/internal/element/reference"
27+ "github.com/verily-src/fhirpath-go/internal/fhir"
28+ "github.com/verily-src/fhirpath-go/internal/fhirconv"
2929 "google.golang.org/protobuf/testing/protocmp"
3030)
3131
@@ -951,6 +951,20 @@ func TestFunctionInvocation_Evaluates(t *testing.T) {
951951 inputCollection : []fhir.Resource {patientChu },
952952 wantCollection : system.Collection {system .Boolean (false ), system .Boolean (true )},
953953 },
954+ {
955+ name : "returns concatenated family name value with join()" ,
956+ inputPath : "name.family.value.join('-')" ,
957+ inputCollection : []fhir.Resource {patientChu },
958+ wantCollection : system.Collection {system .String ("Chu-Chu" )},
959+ compileOptions : []fhirpath.CompileOption {compopts .WithExperimentalFuncs ()},
960+ },
961+ {
962+ name : "returns concatenated family name with join()" ,
963+ inputPath : "name.family.join('-')" ,
964+ inputCollection : []fhir.Resource {patientChu },
965+ wantCollection : system.Collection {system .String ("Chu-Chu" )},
966+ compileOptions : []fhirpath.CompileOption {compopts .WithExperimentalFuncs ()},
967+ },
954968 }
955969
956970 testEvaluate (t , testCases )
@@ -1408,6 +1422,31 @@ func TestPolarityExpression(t *testing.T) {
14081422 testEvaluate (t , testCases )
14091423}
14101424
1425+ func TestAll_Evaluates (t * testing.T ) {
1426+ testCases := []evaluateTestCase {
1427+ {
1428+ name : "returns false if not all elements are integers" ,
1429+ inputPath : "Patient.name.given.all($this is Integer)" ,
1430+ inputCollection : []fhir.Resource {patientChu },
1431+ wantCollection : system.Collection {system .Boolean (false )},
1432+ },
1433+ {
1434+ name : "returns true if input is empty" ,
1435+ inputPath : "{}.all($this is Integer)" ,
1436+ inputCollection : []fhir.Resource {},
1437+ wantCollection : system.Collection {system .Boolean (true )},
1438+ },
1439+ {
1440+ name : "returns true if born during the 21st century" ,
1441+ inputPath : "Patient.birthDate.all($this >= @2000-01-01 and $this < @2100-01-01)" ,
1442+ inputCollection : []fhir.Resource {patientChu },
1443+ wantCollection : system.Collection {system .Boolean (true )},
1444+ },
1445+ }
1446+
1447+ testEvaluate (t , testCases )
1448+ }
1449+
14111450func TestMustCompile_CompileError_Panics (t * testing.T ) {
14121451 defer func () { _ = recover () }()
14131452
0 commit comments