From 2a029ede7b51a0a59a45f0dcd31d73fdc909ca23 Mon Sep 17 00:00:00 2001 From: Ivan Jager Date: Thu, 27 Jun 2019 14:36:31 -0500 Subject: [PATCH] Add failing test for purescript compilation --- runtests | 8 +++++- samples/County.tmpl | 19 +++++--------- samples/SelfContained.tmpl | 54 ++++++++++++++++++++++++++++++++++++++ test/Support.purs | 7 +++++ 4 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 samples/SelfContained.tmpl create mode 100644 test/Support.purs diff --git a/runtests b/runtests index 985c3e3..d347054 100755 --- a/runtests +++ b/runtests @@ -2,7 +2,7 @@ set -e -x -pulp test +pulp build case $1 in ccap) @@ -31,3 +31,9 @@ for i in samples/*.tmpl; do # TODO: Test compilation of generated output. done + +# We can at least test compile this one for now + +./compile -p Test.Generated -m purs -o test/generated samples/SelfContained.tmpl + +pulp test diff --git a/samples/County.tmpl b/samples/County.tmpl index 9a0af28..b0fd467 100644 --- a/samples/County.tmpl +++ b/samples/County.tmpl @@ -28,6 +28,12 @@ module County /* + type County: { countyNo: Domains.CountyNoT countyNoX: CountyNo @@ -66,17 +72,4 @@ module County /* - - - - type Mydate: wrap Date } diff --git a/samples/SelfContained.tmpl b/samples/SelfContained.tmpl new file mode 100644 index 0000000..2f23ad4 --- /dev/null +++ b/samples/SelfContained.tmpl @@ -0,0 +1,54 @@ +// A self-contained example that we can compile without additional +// dependencies. +module SelfContained { + type CountyNo: Int + type CountyName: String + type OtherCountyName: wrap String + type AssessFacilityId: wrap Int + type SomethingMoney: wrap Decimal + + // We can wrap a type in a pre-existing newtype + type Bunnies: wrap Int + + + type County: { + countyNo: CountyNo + countyName: CountyName + assessFacilityId: Maybe AssessFacilityId + soapPort: Int + } + + type Big: { + a1: Int + b1: String + c1: Decimal + d1: Boolean + a2: Int + b2: String + c2: Decimal + d2: Boolean + a3: Int + b3: String + c3: Decimal + d3: Boolean + a4: Int + b4: String + c4: Decimal + d4: Boolean + } + + type Response: { + counties: Array County + } + + type CountyEnum: [ + | Adams + | Ashland + | Baron + | Etc + ] + +} diff --git a/test/Support.purs b/test/Support.purs new file mode 100644 index 0000000..aa6220e --- /dev/null +++ b/test/Support.purs @@ -0,0 +1,7 @@ +module Test.Support where + +import Data.Newtype + +newtype Newint = Newint Int + +derive instance newtypeNewint :: Newtype Newint _