|
1 | 1 | #[test] |
2 | 2 | fn component_is_windows_device() { |
3 | | - for device in ["con", "CONIN$", "lpt1.txt", "AUX", "Prn", "NUL", "COM9"] { |
| 3 | + for device in ["con", "CONIN$", "lpt1.txt", "AUX", "Prn", "NUL", "COM9", "nul.a.b "] { |
4 | 4 | assert!(gix_validate::path::component_is_windows_device(device.into())); |
5 | 5 | } |
6 | | - for not_device in ["coni", "CONIN", "lpt", "AUXi", "aPrn", "NULl", "COM"] { |
| 6 | + for not_device in ["coni", "CONIN", "lpt", "AUXi", "aPrn", "NULl", "COM", "a.nul.b "] { |
7 | 7 | assert!(!gix_validate::path::component_is_windows_device(not_device.into())); |
8 | 8 | } |
9 | 9 | } |
@@ -82,6 +82,9 @@ mod component { |
82 | 82 | mktest!(conin_without_dollar, b"conin"); |
83 | 83 | mktest!(not_con, b"com"); |
84 | 84 | mktest!(also_not_con, b"co"); |
| 85 | + mktest!(con_as_middle, b"x.CON.zip"); |
| 86 | + mktest!(con_after_space, b" CON"); |
| 87 | + mktest!(con_after_space_mixed, b" coN.tar.xz"); |
85 | 88 | mktest!(not_nul, b"null"); |
86 | 89 | mktest!( |
87 | 90 | not_dot_gitmodules_shorter_hfs, |
@@ -248,6 +251,8 @@ mod component { |
248 | 251 | mktest!(prn_mixed_with_extension, b"PrN.abc", Error::WindowsReservedName); |
249 | 252 | mktest!(con, b"CON", Error::WindowsReservedName); |
250 | 253 | mktest!(con_with_extension, b"CON.abc", Error::WindowsReservedName); |
| 254 | + mktest!(con_with_middle, b"CON.tar.xz", Error::WindowsReservedName); |
| 255 | + mktest!(con_mixed_with_middle, b"coN.tar.xz ", Error::WindowsReservedName); |
251 | 256 | mktest!( |
252 | 257 | conout_mixed_with_extension, |
253 | 258 | b"ConOut$ .xyz", |
|
0 commit comments