5 use crate::tests::init;
6 use color_eyre::eyre::{bail, Result};
9 fn parse_simple_comment() -> Result<()> {
15 let _x: &i32 = unsafe { mem::transmute(16usize) }; //~ ERROR encountered a dangling reference (address $HEX is unallocated)
18 let comments = Comments::parse(Path::new("<dummy>"), s)?;
19 println!("parsed comments: {:#?}", comments);
20 assert_eq!(comments.error_matches[0].definition_line, 5);
21 assert_eq!(comments.error_matches[0].revision, None);
23 comments.error_matches[0].matched,
24 "encountered a dangling reference (address $HEX is unallocated)"
30 fn parse_slash_slash_at() -> Result<()> {
33 //@ error-pattern: foomp
37 let comments = Comments::parse(Path::new("<dummy>"), s)?;
38 println!("parsed comments: {:#?}", comments);
39 assert_eq!(comments.error_pattern, Some(("foomp".to_string(), 2)));
44 fn parse_slash_slash_at_fail() -> Result<()> {
47 //@ error-pattern foomp
51 match Comments::parse(Path::new("<dummy>"), s) {
52 Ok(_) => bail!("expected parsing to fail"),