| ... | ... | @@ -720,14 +720,17 @@ pub const TestContext = struct { |
| 720 | 720 | // Move to beginning of line |
| 721 | 721 | while (cursor > 0 and src[cursor - 1] != '\n') cursor -= 1; |
| 722 | 722 | |
| 723 | | // Check if line is non-empty and does not start with "//" |
| 724 | | if (cursor + 1 < src.len and src[cursor + 1] != '\n' and src[cursor + 1] != '\r') { |
| 725 | | if (std.mem.startsWith(u8, src[cursor..], "//")) { |
| 726 | | manifest_start = cursor; |
| 727 | | } else { |
| 728 | | break; |
| 729 | | } |
| 730 | | } else manifest_end = cursor; |
| 723 | if (std.mem.startsWith(u8, src[cursor..], "//")) { |
| 724 | manifest_start = cursor; // Contiguous comment line, include in manifest |
| 725 | } else { |
| 726 | if (manifest_start != null) break; // Encountered non-comment line, end of manifest |
| 727 | |
| 728 | // We ignore all-whitespace lines following the comment block, but anything else |
| 729 | // means that there is no manifest present. |
| 730 | if (std.mem.trim(u8, src[cursor..manifest_end], " \r\n\t").len == 0) { |
| 731 | manifest_end = cursor; |
| 732 | } else break; // If it's not whitespace, there is no manifest |
| 733 | } |
| 731 | 734 | |
| 732 | 735 | // Move to previous line |
| 733 | 736 | if (cursor != 0) cursor -= 1 else break; |