- fixed lexing of inline and postline comments
This commit is contained in:
parent
34573a999e
commit
bcb32b19d4
3 changed files with 18 additions and 12 deletions
|
|
@ -4,10 +4,9 @@ mod lex_tests {
|
|||
#[test]
|
||||
fn test_lex_basic_pair() {
|
||||
let document: &str = "(hello 'world')";
|
||||
let output: &str = "(hello 'world' nil)";
|
||||
match lex(document.to_string()) {
|
||||
Ok(box_cell) => {
|
||||
assert_eq!(format!("{}", *box_cell), output.to_string());
|
||||
assert_eq!(format!("{}", *box_cell), document);
|
||||
},
|
||||
Err(s) => {
|
||||
print!("{}\n", s);
|
||||
|
|
@ -19,10 +18,9 @@ mod lex_tests {
|
|||
#[test]
|
||||
fn test_lex_basic_list() {
|
||||
let document: &str = "(hello 'world' 1 2 3)";
|
||||
let output: &str = "(hello 'world' 1 2 3 nil)";
|
||||
match lex(document.to_string()) {
|
||||
Ok(box_cell) => {
|
||||
assert_eq!(format!("{}", *box_cell), output.to_string());
|
||||
assert_eq!(format!("{}", *box_cell), document);
|
||||
},
|
||||
Err(s) => {
|
||||
print!("{}\n", s);
|
||||
|
|
@ -34,10 +32,9 @@ mod lex_tests {
|
|||
#[test]
|
||||
fn test_lex_complex_list() {
|
||||
let document: &str = "(hello 'world' (1 2 (1 2 3)) 1 2 3)";
|
||||
let output: &str = "(hello 'world' (1 2 (1 2 3 nil) nil) 1 2 3 nil)";
|
||||
match lex(document.to_string()) {
|
||||
Ok(box_cell) => {
|
||||
assert_eq!(format!("{}", *box_cell), output.to_string());
|
||||
assert_eq!(format!("{}", *box_cell), document);
|
||||
},
|
||||
Err(s) => {
|
||||
print!("{}\n", s);
|
||||
|
|
@ -94,7 +91,7 @@ mod lex_tests {
|
|||
#[test]
|
||||
fn test_comment() {
|
||||
let document: &str = "#!/bin/relish\n(one two)";
|
||||
let output: &str = "(one two nil)";
|
||||
let output: &str = "(one two)";
|
||||
match lex(document.to_string()) {
|
||||
Ok(box_cell) => {
|
||||
assert_eq!(format!("{}", *box_cell), output.to_string());
|
||||
|
|
@ -109,7 +106,7 @@ mod lex_tests {
|
|||
#[test]
|
||||
fn test_postline_comment() {
|
||||
let document: &str = "#!/bin/relish\n((one two)# another doc comment\n(three four))";
|
||||
let output: &str = "(one two nil)";
|
||||
let output: &str = "((one two) (three four))";
|
||||
match lex(document.to_string()) {
|
||||
Ok(box_cell) => {
|
||||
assert_eq!(format!("{}", *box_cell), output.to_string());
|
||||
|
|
@ -124,7 +121,7 @@ mod lex_tests {
|
|||
#[test]
|
||||
fn test_inline_comment() {
|
||||
let document: &str = "#!/bin/relish\n((one two)\n# another doc comment\nthree)";
|
||||
let output: &str = "(one two nil)";
|
||||
let output: &str = "((one two) three)";
|
||||
match lex(document.to_string()) {
|
||||
Ok(box_cell) => {
|
||||
assert_eq!(format!("{}", *box_cell), output.to_string());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue