Skip to content

Commit 9b376ca

Browse files
committed
Migrate invalid heading test to parser test
Makes more sense as a parser test.
1 parent e73f8b3 commit 9b376ca

File tree

2 files changed

+10
-49
lines changed

2 files changed

+10
-49
lines changed

mask-parser/src/parser.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,16 @@ fi
313313
314314
echo "This is required - $required"
315315
~~~
316+
317+
# This is an invalid H1, so it will be ignored
318+
319+
## invalid_cmd
320+
321+
Everything below an invalid H1 will also be ignored.
322+
323+
~~~bash
324+
echo hey
325+
~~~
316326
"#;
317327

318328
#[cfg(test)]

mask/tests/subcommands_test.rs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -134,52 +134,3 @@ Write-Output "Start all services"
134134
.success();
135135
}
136136
}
137-
138-
mod when_another_level_1_heading_is_found {
139-
use super::*;
140-
141-
#[test]
142-
fn subcommands_above_level_1_work() {
143-
let (_temp, maskfile_path) = common::maskfile(
144-
r#"
145-
## start
146-
~~~bash
147-
echo "start"
148-
~~~
149-
150-
# invalid level 1 heading
151-
"#,
152-
);
153-
154-
common::run_mask(&maskfile_path)
155-
.cli("start")
156-
.assert()
157-
.stdout(contains("start"))
158-
.success();
159-
}
160-
161-
#[test]
162-
fn subcommands_below_level_1_are_ignored() {
163-
let (_temp, maskfile_path) = common::maskfile(
164-
r#"
165-
## start
166-
~~~bash
167-
echo "start"
168-
~~~
169-
170-
# invalid level 1 heading
171-
172-
## ignored
173-
~~~bash
174-
echo "ignored"
175-
~~~
176-
"#,
177-
);
178-
179-
common::run_mask(&maskfile_path)
180-
.cli("ignored")
181-
.assert()
182-
.stderr(contains("error: Found argument 'ignored' which wasn't expected, or isn't valid in this context"))
183-
.failure();
184-
}
185-
}

0 commit comments

Comments
 (0)