-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
277 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use std::sync::Arc; | ||
|
||
use scheme_rs::{ | ||
builtin, | ||
continuation::Continuation, | ||
env::Env, | ||
error::RuntimeError, | ||
gc::Gc, | ||
lex::Token, | ||
syntax::ParsedSyntax, | ||
value::{eqv, Value}, | ||
}; | ||
|
||
#[builtin("assert-eq")] | ||
pub async fn test_assert( | ||
_cont: &Option<Arc<Continuation>>, | ||
arg1: &Gc<Value>, | ||
arg2: &Gc<Value>, | ||
) -> Result<Vec<Gc<Value>>, RuntimeError> { | ||
// | ||
if !eqv(arg1, arg2).await { | ||
let arg1 = arg1.read().await.fmt().await; | ||
let arg2 = arg2.read().await.fmt().await; | ||
Err(RuntimeError::assert_eq_failed(&arg1, &arg2)) | ||
} else { | ||
Ok(vec![]) | ||
} | ||
} | ||
|
||
#[tokio::test] | ||
async fn r6rs() { | ||
let top = Env::top().await; | ||
|
||
let r6rs_tok = Token::tokenize_file(include_str!("r6rs.scm"), "r6rs.scm").unwrap(); | ||
let r6rs_sexprs = ParsedSyntax::parse(&r6rs_tok).unwrap(); | ||
for sexpr in r6rs_sexprs { | ||
sexpr | ||
.compile(&top, &None) | ||
.await | ||
.unwrap() | ||
.eval(&top, &None) | ||
.await | ||
.unwrap(); | ||
} | ||
} |
Oops, something went wrong.