Skip to content

Commit bb2648b

Browse files
Fix tests under windows-latest CI runner (#129)
* Add powershell script for windows I have no idea why this just started failing under GitHub Action's windows-latest runner. It has been working fine for years as far as I can tell... running the bash command as is. In the other tests I include powershell, so doing that here makes sense and will prevent the issue. * Migrate invalid heading test to parser test Makes more sense as a parser test.
1 parent da64bf7 commit bb2648b

File tree

2 files changed

+14
-49
lines changed

2 files changed

+14
-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: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -120,62 +120,17 @@ mod when_subcommands_do_not_include_their_parent_command_prefix {
120120
~~~bash
121121
echo "Start all services"
122122
~~~
123-
"#,
124-
);
125-
126-
common::run_mask(&maskfile_path)
127-
.cli("services start all")
128-
.assert()
129-
.stdout(contains("Start all services"))
130-
.success();
131-
}
132-
}
133123
134-
mod when_another_level_1_heading_is_found {
135-
use super::*;
136-
137-
#[test]
138-
fn subcommands_above_level_1_work() {
139-
let (_temp, maskfile_path) = common::maskfile(
140-
r#"
141-
## start
142-
~~~bash
143-
echo "start"
124+
~~~powershell
125+
Write-Output "Start all services"
144126
~~~
145-
146-
# invalid level 1 heading
147127
"#,
148128
);
149129

150130
common::run_mask(&maskfile_path)
151-
.cli("start")
131+
.cli("services start all")
152132
.assert()
153-
.stdout(contains("start"))
133+
.stdout(contains("Start all services"))
154134
.success();
155135
}
156-
157-
#[test]
158-
fn subcommands_below_level_1_are_ignored() {
159-
let (_temp, maskfile_path) = common::maskfile(
160-
r#"
161-
## start
162-
~~~bash
163-
echo "start"
164-
~~~
165-
166-
# invalid level 1 heading
167-
168-
## ignored
169-
~~~bash
170-
echo "ignored"
171-
~~~
172-
"#,
173-
);
174-
175-
common::run_mask(&maskfile_path)
176-
.cli("ignored")
177-
.assert()
178-
.stderr(contains("error: Found argument 'ignored' which wasn't expected, or isn't valid in this context"))
179-
.failure();
180-
}
181136
}

0 commit comments

Comments
 (0)