Skip to content

Commit

Permalink
tests: migrate to new testing script (partially)
Browse files Browse the repository at this point in the history
also see #350 for what's missing
[skip lemma]
  • Loading branch information
Zilin Chen authored and Zilin Chen committed Feb 6, 2020
1 parent 51ab682 commit 2771ae4
Show file tree
Hide file tree
Showing 18 changed files with 409 additions and 19 deletions.
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This file is modified by Zilin Chen, based on the template generated by https://github.com/hvr/multi-ghc-travis

language: c
python:
- "3.7"
sudo: required
dist: trusty

Expand Down Expand Up @@ -78,6 +80,7 @@ before_install:
- export ALEXVER=3.1.7
- export HAPPYVER=1.19.5
- export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$REPO/cogent/$SANDBOX/bin:$PATH
- pip install termcolor ruamel.yaml

install:
# Get AutoCorres
Expand Down Expand Up @@ -168,15 +171,7 @@ script:
# Check if Cogent has been correctly installed
- which cogent || travis_terminate 1
# - echo 'Running tests'
- make test-pp
- make test-tc
- make test-ds
- make test-an
- make test-mn
- make test-cg
- make test-gcc
- make test-aq
- make test-flags
- make test-compiler
# - echo 'Typechecking libgum'
- make test-libgum
# - echo 'Building Cogent examples'
Expand Down
11 changes: 6 additions & 5 deletions cogent/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build configure install
.PHONY: build configure install test-compiler

## Silent by default
V =
Expand Down Expand Up @@ -100,10 +100,11 @@ tests/include/%_dummy.h: tests/%.cogent
.test-setup:
$(Q)mkdir -p tests/include

test-compiler: test-clean .test-cogent \
test-tc test-ds test-an test-mn test-cg test-gcc \
test-pp test-aq \
test-hs
test-compiler: .test-cogent
./tests/run-test-suite.py \
# test-tc test-ds test-an test-mn test-cg test-gcc \
# test-pp test-aq \
# test-hs

tests: test-compiler \
test-tc-proof test-shallow-proof test-ee
Expand Down
2 changes: 1 addition & 1 deletion cogent/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Run the script with `-h` or `--help` for a more detailed explanation.
## Dependancies

The test script depends on the following python modules:
* [ruamel](https://yaml.readthedocs.io/en/latest/)
* [ruamel.yaml](https://yaml.readthedocs.io/en/latest/)
* [termcolor](https://pypi.org/project/termcolor/)

## Future improvements/feature suggestions
Expand Down
4 changes: 2 additions & 2 deletions cogent/tests/tests/case/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- test_name: case-pass
- test_name: pass-case
files:
- pass_case-default.cogent
- pass_case-default-constructor.cogent
Expand All @@ -11,7 +11,7 @@
flags:
- "-g"

- test_name: case-fail
- test_name: fail-case
files:
- fail_unmatched-case.cogent
expected_result: fail
Expand Down
25 changes: 25 additions & 0 deletions cogent/tests/tests/if-condition/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- test_name: pass-if
files:
- pass_if-prmt-int.cogent
- pass_multiway-if.cogent
- pass_multiway-if-linear.cogent
expected_result: pass
flags:
- -g

- test_name: fail-if
files:
- fail_herp-if-non-arith.cogent
- fail_multiway-if-linear.cogent
- fail_multiway-if-no-else.cogent
- fail_multiway-if-one-branch.cogent
expected_result: fail
flags:
- -t

- test_name: reftypes-if
files:
- wip_herp-if-if.cogent
expected_result: wip
flags:
- -g
22 changes: 22 additions & 0 deletions cogent/tests/tests/let/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- test_name: pass-let
files:
- pass_let-if.cogent
- pass_simple-let.cogent
expected_result: pass
flags:
- -g

- test_name: fail-let
files:
- fail_let-upcast.cogent
expected_result: fail
flags:
- -t

- test_name: wip-let
files:
- wip_let-let.cogent
expected_result: wip
flags:
- -g

20 changes: 20 additions & 0 deletions cogent/tests/tests/letbang/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- test_name: pass-letbang
files:
- pass_anormal-letbang.cogent
- pass_deep-letbang-on-tag-union.cogent
- pass_inline-func-letbang.cogent
- pass_letbang.cogent
- pass_letbang-cond-type-annot.cogent
- pass_letbang-not-escape-fix.cogent
- pass_letbang-not-used-in-subexpr.cogent
expected_result: pass
flags:
- -g

- test_name: fail-letbang
files:
- fail_extra_letbang.cogent
- fail_letbang-not-escape.cogent
expected_result: fail
flags:
- -t
107 changes: 107 additions & 0 deletions cogent/tests/tests/misc/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
- test_name: pass-misc
files:
- pass_abs-para-ty-cg.cogent
- pass_app-comp-1.cogent
- pass_app-comp-2.cogent
- pass_basic-features.cogent
- pass_bitwise.cogent
- pass_bool-type.cogent
- pass_capture.cogent
- pass_char-is-u8.cogent
- pass_code-in-return.cogent
- pass_compare-bool.cogent
- pass_compl.cogent
- pass_constant-with-digit.cogent
- pass_corres-setup.cogent
- pass_cpp.cogent
- pass_debug.cogent
- pass_differing-num-con-args-1.cogent
- pass_differing-num-con-args.cogent
- pass_error-comparison.cogent
- pass_explicit-var-upcast.cogent
- pass_ext2-mount.cogent
- pass_ex-variants.cogent
- pass_fun-type-synonym.cogent
- pass_handle-return.cogent
- pass_hs-variants.cogent
- pass_implicit-literal-upcast.cogent
- pass_inline-pragma.cogent
- pass_large-code.cogent
- pass_lax-wildcard.cogent
- pass_lots_of_absfun.cogent
- pass_member.cogent
- pass_multi-arg-cons.cogent
- pass_nested-comments.cogent
- pass_nested-err-handling.cogent
- pass_non-dec-ints.cogent
- pass_param-synonym-expand.cogent
- pass_partial-typeapp.cogent
- pass_phantom.cogent
- pass_prim-int-upcast.cogent
- pass_promote-variant.cogent
- pass_return-funtype.cogent
- pass_reuse-var.cogent
- pass_scoped-type-var.cogent
- pass_serialise-simple.cogent
- pass_sinkfloat-test-0.cogent
- pass_type-annot-expr.cogent
- pass_typedef.cogent
- pass_type-holes-1.cogent
- pass_undefined.cogent
- pass_underscore-wildcard.cogent
- pass_unicode-literals.cogent
- pass_unify-if.cogent
- pass_unknown-underscore-type.cogent
- pass_useability-in-default.cogent
- pass_warn-shadow-var.cogent
- pass_warn-unused-local-bind.cogent
- pass_weakening1.cogent
- pass_weakening2.cogent
- include_pass_cpp.cogent
expected_result: pass
flags:
- -g

- test_name: fail-misc
files:
- fail_char-expr.cogent
- fail_compare_bool_int.cogent
- fail_compare_non_prim_type.cogent
- fail_conflict-fieldname.cogent
- fail_conflict-fieldname-nested.cogent
- fail_const-parse.cogent
- fail_datacons-arg-number-diff.cogent
- fail_discard-linear.cogent
- fail_double-use-linear-ur.cogent
- fail_dup-type.cogent
- fail_dup-type-var.cogent
- fail_dup-val.cogent
- fail_dup-val-sig.cogent
- fail_ex-variant-dup-pvars.cogent
- fail_linear-used-multi-times.cogent
- fail_lin-underscore-2.cogent
- fail_lin-underscore.cogent
- fail_non-shareable-const.cogent
- fail_out-of-scope-typevar.cogent
- fail_readonly-escape.cogent
- fail_scoped-type-var.cogent
- fail_too-many-type-args.cogent
- fail_to-raw-type.cogent
- fail_typeapp-ill-formed.cogent
- fail_ur-field-names.cogent
- fail_ur-more-fields.cogent
- fail_var-already-used.cogent
- fail_warn-unused-local-bind.cogent
expected_result: fail
flags:
- -t

- test_name: wip-misc
files:
- fixme_abstract-const.cogent
- fixme_guards.cogent
- shouldfail_const-not-const.cogent
- shouldfail_overlapping_pcons.cogent
expected_result: wip
flags:
- -t
21 changes: 21 additions & 0 deletions cogent/tests/tests/patterns/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- test_name: pass-patterns
files:
- pass_biased-pattern-1.cogent
- pass_biased-pattern-1-compare.cogent
- pass_biased-pattern-2.cogent
- pass_biased-pattern-2-compare.cogent
- pass_biased-pattern-3.cogent
- pass_biased-pattern-3-compare.cogent
- pass_pattern-in-parens.cogent
expected_result: pass
flags:
- -g

- test_name: fail-patterns
files:
- fail_char-pattern.cogent
- fail_conflict-pattern-var-1.cogent
- fail_conflict-pattern-var-2.cogent
expected_result: fail
flags:
- -t
18 changes: 18 additions & 0 deletions cogent/tests/tests/polymorphic/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- test_name: pass-polymorphic
files:
- pass_poly-simple.cogent
expected_result: pass
flags:
- -g

- test_name: fail-polymorphic
files:
- fail_dup-poly-var.cogent
- fail_flags_ffi-gen-poly
- fail_poly-const.cogent
- fail_poly-put-all.cogent
- fail_poly-take-all.cogent
- fail_poly-take-f1.cogent
expected_result: fail
flags:
- -t
14 changes: 14 additions & 0 deletions cogent/tests/tests/simple/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- test_name: pass-simple
files:
- pass_simple-arith.cogent
- pass_simple-con.cogent
- pass_simple-cpp.cogent
- pass_simple-fun.cogent
- pass_simple-if.cogent
- pass_simple-obj.cogent
- pass_simple-split.cogent
- pass_simple-string-lit.cogent
- pass_simple-struct.cogent
expected_result: pass
flags:
- -g
File renamed without changes.
4 changes: 2 additions & 2 deletions cogent/tests/tests/subtyping/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- test_name: subtyping-tests
- test_name: pass-subtyping
files:
- pass_none-subtyping.cogent
- pass_subtyping-con-promote.cogent
Expand All @@ -12,4 +12,4 @@
- sinkfloat_promotion_test.cogent
expected_result: pass
flags:
- --typecheck
- -t
54 changes: 54 additions & 0 deletions cogent/tests/tests/take-put/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

- test_name: pass-take-put
files:
- pass_put-and-take.cogent
- pass_put-discardable-field.cogent
- pass_put-nonlinear-more-than-once.cogent
- pass_put-untaken-nonlinear.cogent
- pass_put-wildcard-promote.cogent
- pass_simple-put.cogent
- pass_simple-take.cogent
- pass_simple-take-put.cogent
- pass_take-put-all.cogent
- pass_take-put-return-fail.cogent
- pass_take-put-variant.cogent
- pass_take-put-verbose.cogent
- pass_wf-take-idem-1.cogent
- pass_wf-take-idem-2.cogent
- pass_wf-take-put-tc-1.cogent
- pass_wf-take-put-tc-2.cogent
- pass_wf-take-put-tc-3.cogent
- pass_yet-another-take-put.cogent
expected_result: pass
flags:
- -g

- test_name: fail-take-put
files:
- fail_lax-take-put.cogent
- fail_no-need-to-take-all.cogent
- fail_taken-inner.cogent
- fail_take-nonexist-field.cogent
- fail_take-put-parser-1.cogent
- fail_take-put-parser-2.cogent
- fail_take-put-parser-3.cogent
- fail_take-put-parser-4.cogent
- fail_take-taken-fld.cogent
- fail_use-nonlinear-taken-field.cogent
- fail_wf-take-nonexisting-field.cogent
- fail_wf-take-nothing-nonrec.cogent
- fail_wf-take-something-nonrec.cogent
- fail_wf-take-tyvar.cogent
- shouldfail_put-linear-more-than-once.cogent
- shouldfail_take-linear-more-than-once.cogent
- shouldfail_take-nonlinear-more-than-once.cogent
expected_result: fail
flags:
- -t

- test_name: shouldfail-take-put
files:
- shouldfail_take-same-fields.cogent
expected_result: wip
flags:
- -t
Loading

0 comments on commit 2771ae4

Please sign in to comment.