()
| 2593 | |
| 2594 | #[test] |
| 2595 | fn parse_comments() { |
| 2596 | let pat = "(?x) |
| 2597 | # This is comment 1. |
| 2598 | foo # This is comment 2. |
| 2599 | # This is comment 3. |
| 2600 | bar |
| 2601 | # This is comment 4."; |
| 2602 | let astc = parser(pat).parse_with_comments().unwrap(); |
| 2603 | assert_eq!( |
| 2604 | astc.ast, |
| 2605 | concat_with(span_range(pat, 0..pat.len()), vec![ |
| 2606 | flag_set(pat, 0..4, ast::Flag::IgnoreWhitespace, false), |
| 2607 | lit_with('f', span_range(pat, 26..27)), |
| 2608 | lit_with('o', span_range(pat, 27..28)), |
| 2609 | lit_with('o', span_range(pat, 28..29)), |
| 2610 | lit_with('b', span_range(pat, 74..75)), |
| 2611 | lit_with('a', span_range(pat, 75..76)), |
| 2612 | lit_with('r', span_range(pat, 76..77)), |
| 2613 | ])); |
| 2614 | assert_eq!(astc.comments, vec![ |
| 2615 | ast::Comment { |
| 2616 | span: span_range(pat, 5..26), |
| 2617 | comment: s(" This is comment 1."), |
| 2618 | }, |
| 2619 | ast::Comment { |
| 2620 | span: span_range(pat, 30..51), |
| 2621 | comment: s(" This is comment 2."), |
| 2622 | }, |
| 2623 | ast::Comment { |
| 2624 | span: span_range(pat, 53..74), |
| 2625 | comment: s(" This is comment 3."), |
| 2626 | }, |
| 2627 | ast::Comment { |
| 2628 | span: span_range(pat, 78..98), |
| 2629 | comment: s(" This is comment 4."), |
| 2630 | }, |
| 2631 | ]); |
| 2632 | } |
| 2633 | |
| 2634 | #[test] |
| 2635 | fn parse_holistic() { |
nothing calls this directly
no test coverage detected