Skip to content
Permalink
Browse files

[language/functional tests] pass comments with no special meanings th…

…rough
  • Loading branch information...
vgao1996 committed Aug 8, 2019
1 parent 76e8f50 commit 1acec930f3417d6ba75cf5b25f0fa2f0d5fb715e
@@ -21,7 +21,7 @@ pub use ir_to_bytecode_syntax::ast;
// comments for now. Will later on add in other comment types.
fn strip_comments(string: &str) -> String {
// Remove line comments
let line_comments = Regex::new(r"//.*(\r\n|\n|\r)").unwrap();
let line_comments = Regex::new(r"(?m)//.*$").unwrap();

This comment has been minimized.

Copy link
@tnowacki

tnowacki Aug 13, 2019

@tzakian will be completely reworking this parsing, so heads up @vgao1996 you might need to rework some of this

line_comments.replace_all(string, "$1").into_owned()
}

@@ -40,7 +40,17 @@ impl FromStr for Directive {
// TODO: implement transaction directive
unimplemented!();
}
Ok(Directive::Check(s.to_string()))
if s.starts_with("check:")
|| s.starts_with("sameln:")
|| s.starts_with("nextln:")
|| s.starts_with("unordered:")
|| s.starts_with("not:")
|| s.starts_with("regex:")
{
Ok(Directive::Check(s.to_string()))
} else {
Err(ErrorKind::Other("unrecognized directive".to_string()).into())
}
}
}

@@ -10,6 +10,8 @@ use crate::{
fn parse_directives() {
for s in &[
"abc",
"// not a directive",
"//",
"// stage: runtime bad ",
"// stage: bad stage",
"// stage: ",
@@ -21,6 +23,10 @@ fn parse_directives() {
"// check: abc",
" // check: abc",
"//not: foo",
"// sameln: abc",
"// nextln: abc",
"// unordered: abc",
"// regex: X=aaa",
"// stage: parser",
"// stage: compiler",
"// stage: verifier",
@@ -7,7 +7,7 @@ fn parse_input_no_transactions() {

#[test]
fn parse_input_no_transactions_with_config() {
parse_input("//! no-verify").unwrap_err();
parse_input("//! no-run: verifier").unwrap_err();
}

#[rustfmt::skip]

0 comments on commit 1acec93

Please sign in to comment.
You can’t perform that action at this time.