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