diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-10 19:16:51 +0300 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-10 19:16:51 +0300 |
commit | d6d1ec80ffcc0b13234b170a91b920371078a027 (patch) | |
tree | a8347b04ad354e3f2cb265b5d506a4891853cf7f /src/sexp/step.rs | |
parent | 06798d622327707ca3f3b42d65fc3d1a25ae3c57 (diff) | |
download | myslip-d6d1ec80ffcc0b13234b170a91b920371078a027.tar.gz myslip-d6d1ec80ffcc0b13234b170a91b920371078a027.zip |
Added tests for functions
Diffstat (limited to 'src/sexp/step.rs')
-rw-r--r-- | src/sexp/step.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sexp/step.rs b/src/sexp/step.rs index c26dce9..8cc1e64 100644 --- a/src/sexp/step.rs +++ b/src/sexp/step.rs @@ -270,6 +270,22 @@ impl SExp { /// ); /// ``` /// + /// **Functions** + /// ```rust + /// use myslip::{sexp::{SExp::*, SLeaf::*, util::*}, r#type::{Type::*, util::*}}; + /// + /// let varlist = scons(var("a"), scons(var("b"), Nil)); + /// let typelist = scons(Ty(List(vec![Integer])), Nil); + /// let ret = Atom(Ty(Boolean)); + /// let body = scons(Gt, varlist.clone()); + /// let fun = scons(Fun, scons(varlist, scons(typelist, scons(ret, scons(body, Nil))))); + /// let args = scons(2, scons(1, Nil)); + /// assert_eq!( + /// scons(fun, scons(args, Nil)).multistep(), + /// Ok(Atom(True)) + /// ); + /// ``` + /// /// Shadowing: /// ```rust /// use myslip::sexp::{SExp::*, SLeaf::*, util::*}; |