Skip to content

Commit eb1774b

Browse files
committed
More test cases
1 parent 3df8564 commit eb1774b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tests/v2_schema_test.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ fn test_v2_path() -> Result<(), Box<dyn Error>> {
8888
// https://github.com/santhosh-tekuri/boon/issues/19
8989
json!("../outside/path"),
9090
json!("thing/../other"),
91+
json!(null),
92+
json!(""),
93+
json!("C:\\foo"),
9194
] {
9295
if schemas.validate(&invalid_path, idx).is_ok() {
9396
panic!("{} unexpectedly passed!", invalid_path)
@@ -123,11 +126,17 @@ fn test_v2_path_pattern() -> Result<(), Box<dyn Error>> {
123126
}
124127

125128
// Test invalid paths.
126-
for invalid_path in [json!("this\\and\\that.txt")] {
129+
for invalid_path in [
130+
json!("this\\and\\that.txt"),
131+
json!(null),
132+
json!(""),
133+
json!("C:\\foo"),
134+
] {
127135
if schemas.validate(&invalid_path, idx).is_ok() {
128136
panic!("{} unexpectedly passed!", invalid_path)
129137
}
130138
}
139+
131140
Ok(())
132141
}
133142

@@ -185,6 +194,20 @@ fn test_v2_version_range() -> Result<(), Box<dyn Error>> {
185194
}
186195
}
187196

197+
// Test invalid ranges.
198+
for invalid_range in [
199+
json!("this\\and\\that.txt"),
200+
json!(null),
201+
json!(""),
202+
json!("C:\\foo"),
203+
json!(">2.0 and <3.0"),
204+
json!("==2.0 or ==3.0"),
205+
] {
206+
if schemas.validate(&invalid_range, idx).is_ok() {
207+
panic!("{} unexpectedly passed!", invalid_range)
208+
}
209+
}
210+
188211
Ok(())
189212
}
190213

@@ -352,6 +375,7 @@ fn test_v2_platform() -> Result<(), Box<dyn Error>> {
352375
for invalid_platform in [
353376
json!("darwin amd64"),
354377
json!("linux/amd64"),
378+
json!("x86_64"),
355379
json!("darwin_23.5.0_arm64"),
356380
json!(null),
357381
json!("0"),

0 commit comments

Comments
 (0)