additional comment form
This commit is contained in:
parent
ce3dba470a
commit
61a1b47b85
3 changed files with 48 additions and 20 deletions
|
|
@ -14,16 +14,16 @@ mod lex_tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_lex_complex_list() {
|
||||
let document = String::from("(hello 'world' (1 2 (1 2 3)) 1 2 3)");
|
||||
assert_eq!(lex(&document).unwrap().to_string(), document);
|
||||
fn test_bad_symbol() {
|
||||
let document = String::from("(as/dd)");
|
||||
let output: &str = "Problem lexing document: \"Unparsable token: as/dd\"";
|
||||
assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bad_symbol() {
|
||||
let document = String::from("(as;dd)");
|
||||
let output: &str = "Problem lexing document: \"Unparsable token: as;dd\"";
|
||||
assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
|
||||
fn test_lex_complex_list() {
|
||||
let document = String::from("(hello 'world' (1 2 (1 2 3)) 1 2 3)");
|
||||
assert_eq!(lex(&document).unwrap().to_string(), document);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -53,23 +53,45 @@ mod lex_tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_comment() {
|
||||
fn test_comment_1() {
|
||||
let document = String::from("#!/bin/relish\n(one two)");
|
||||
let output: &str = "(one two)";
|
||||
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_postline_comment() {
|
||||
fn test_comment_2() {
|
||||
let document = String::from(";; big doc string\n(one two)");
|
||||
let output: &str = "(one two)";
|
||||
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_postline_comment_1() {
|
||||
let document =
|
||||
String::from("#!/bin/relish\n((one two)# another doc comment\n(three four))");
|
||||
String::from("#!/bin/relish\n((one two)# another doc comment\n('three' four))");
|
||||
let output: &str = "((one two) ('three' four))";
|
||||
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_postline_comment_2() {
|
||||
let document =
|
||||
String::from("#!/bin/relish\n((one two);;another doc comment\n(three four))");
|
||||
let output: &str = "((one two) (three four))";
|
||||
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_inline_comment() {
|
||||
let document = String::from("#!/bin/relish\n((one two)\n# another doc comment\nthree)");
|
||||
fn test_inline_comment_1() {
|
||||
let document = String::from("#!/bin/relish\n((one two)\n# another comment\nthree)");
|
||||
let output: &str = "((one two) three)";
|
||||
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_inline_comment_2() {
|
||||
let document = String::from("# head\n((one two)\n;; another comment\nthree)");
|
||||
let output: &str = "((one two) three)";
|
||||
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue