Skip to content

Commit 6daaba3

Browse files
committed
Use br literals to express \ paths more clearly in tests
In `gix-validate` tests that Windows-style paths are validated correctly, this changes byte strings that contain `\` to be raw byte string literals (`rb`) instead of non-raw byte string literals (`b`). This is to improve readability given that some literals contain consecutive backslashes: this makes it easier to tell if, and how many, consecutive backslashes there are.
1 parent ad7a94e commit 6daaba3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

gix-validate/tests/path/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ mod component {
5353

5454
mktest!(ascii, b"ascii-only_and-that");
5555
mktest!(unicode, "😁👍👌".as_bytes());
56-
mktest!(backslashes_on_unix, b"\\", UNIX_OPTS);
56+
mktest!(backslashes_on_unix, br"\", UNIX_OPTS);
5757
mktest!(drive_letters_on_unix, b"c:", UNIX_OPTS);
5858
mktest!(virtual_drive_letters_on_unix, "֍:".as_bytes(), UNIX_OPTS);
59-
mktest!(unc_path_on_unix, b"\\\\?\\pictures", UNIX_OPTS);
59+
mktest!(unc_path_on_unix, br"\\?\pictures", UNIX_OPTS);
6060
mktest!(not_dot_git_longer, b".gitu", NO_OPTS);
6161
mktest!(not_dot_git_longer_all, b".gitu");
6262
mktest!(not_dot_gitmodules_shorter, b".gitmodule", Symlink, NO_OPTS);
@@ -66,7 +66,7 @@ mod component {
6666
mktest!(dot_gitmodules_as_file, b".gitmodules", UNIX_OPTS);
6767
mktest!(
6868
starts_with_dot_git_with_backslashes_on_linux,
69-
b".git\\hooks\\pre-commit",
69+
br".git\hooks\pre-commit",
7070
UNIX_OPTS
7171
);
7272
mktest!(not_dot_git_shorter, b".gi", NO_OPTS);
@@ -136,7 +136,7 @@ mod component {
136136
mktest!(dot_git_upper, b".GIT", Error::DotGitDir, NO_OPTS);
137137
mktest!(
138138
starts_with_dot_git_with_backslashes_on_windows,
139-
b".git\\hooks\\pre-commit",
139+
br".git\hooks\pre-commit",
140140
Error::PathSeparator
141141
);
142142
mktest!(dot_git_upper_hfs, ".GIT\u{200e}".as_bytes(), Error::DotGitDir);
@@ -225,10 +225,10 @@ mod component {
225225
mktest!(path_separator_slash_trailing, b"a/", Error::PathSeparator);
226226
mktest!(path_separator_slash_only, b"/", Error::PathSeparator);
227227
mktest!(slashes_on_windows, b"/", Error::PathSeparator, ALL_OPTS);
228-
mktest!(backslashes_on_windows, b"\\", Error::PathSeparator, ALL_OPTS);
229-
mktest!(path_separator_backslash_between, b"a\\b", Error::PathSeparator);
230-
mktest!(path_separator_backslash_leading, b"\\a", Error::PathSeparator);
231-
mktest!(path_separator_backslash_trailing, b"a\\", Error::PathSeparator);
228+
mktest!(backslashes_on_windows, br"\", Error::PathSeparator, ALL_OPTS);
229+
mktest!(path_separator_backslash_between, br"a\b", Error::PathSeparator);
230+
mktest!(path_separator_backslash_leading, br"\a", Error::PathSeparator);
231+
mktest!(path_separator_backslash_trailing, br"a\", Error::PathSeparator);
232232
mktest!(aux_mixed, b"Aux", Error::WindowsReservedName);
233233
mktest!(aux_with_extension, b"aux.c", Error::WindowsReservedName);
234234
mktest!(com_lower, b"com1", Error::WindowsReservedName);
@@ -261,7 +261,7 @@ mod component {
261261
Error::WindowsPathPrefix,
262262
ALL_OPTS
263263
);
264-
mktest!(unc_path, b"\\\\?\\pictures", Error::PathSeparator, ALL_OPTS);
264+
mktest!(unc_path, br"\\?\pictures", Error::PathSeparator, ALL_OPTS);
265265

266266
#[test]
267267
fn ntfs_gitmodules() {

0 commit comments

Comments
 (0)