From a70dcaa949f41c585f9aea5e79f2550053d8e857 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Tue, 19 Aug 2025 13:55:05 +0300 Subject: test: added boilerplate and tests for coproduct parsing, type checking and evaluation --- src/sexp/step.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/sexp/step.rs') diff --git a/src/sexp/step.rs b/src/sexp/step.rs index 59b201c..3168c5b 100644 --- a/src/sexp/step.rs +++ b/src/sexp/step.rs @@ -297,6 +297,14 @@ impl SExp { /// assert_eq!(exp, expshould); /// let exp = exp.and_then(|e| e.step()); /// assert_eq!(exp, Ok(Atom(True))); + /// + /// let exp = "case (coprod Bool (+ 1 2)) ((inl b) (if b 1 0)) ((inr x) (- x 1))"; + /// let exp = parse_to_ast(exp); + /// let exp = exp.and_then(|e| e.step()); + /// let expshould = parse_to_ast("case (coprod Bool 3) ((inl b) (if b 1 0)) ((inr x) (- x 1))"); + /// assert_eq!(exp, expshould); + /// let exp = exp.and_then(|e| e.step()); + /// assert_eq!(exp, Ok(scons(Sub, scons(3, scons(1, Nil))))); /// ``` /// /// Shadowing: -- cgit v1.2.3