-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from hiratara/support-anyhow
Support anyhow crate
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
extern crate lambda_calculus as lambda; | ||
|
||
use lambda::{parser::parse, term::Notation::Classic}; | ||
use std::error::Error; | ||
|
||
#[test] | ||
fn parse_error_question_mark_operator() { | ||
match using_question_mark_operator() { | ||
Result::Ok(_) => panic!("Should not be Ok"), | ||
Result::Err(e) => assert_eq!(e.to_string(), "syntax error; the expression is empty"), | ||
} | ||
} | ||
|
||
fn using_question_mark_operator() -> Result<(), Box<dyn Error>> { | ||
parse("λλλ", Classic)?; | ||
Ok(()) | ||
} |
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,17 @@ | ||
extern crate lambda_calculus as lambda; | ||
|
||
use lambda::term::Term; | ||
use std::error::Error; | ||
|
||
#[test] | ||
fn term_error_question_mark_operator() { | ||
match using_question_mark_operator() { | ||
Result::Ok(_) => panic!("Should not be Ok"), | ||
Result::Err(e) => assert_eq!(e.to_string(), "the term is not an abstraction"), | ||
} | ||
} | ||
|
||
fn using_question_mark_operator() -> Result<(), Box<dyn Error>> { | ||
Term::Var(0).unabs()?; | ||
Ok(()) | ||
} |