Skip to content

Commit 96137cc

Browse files
committed
Fix some test failures on Windows
Our tests are checking for stdout output which is specific to unix path separators. This changes these tests to allow any character in those positions. This could be more specific about exactly what character is allowed based on the platform, but the signal to noise ratio there would get insane, and I don't think it's worthwhile. We still have some failures related to file lock contention which will be a bit harder to fix.
1 parent 8077397 commit 96137cc

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

diesel_cli/tests/migration_generate.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ fn migration_generate_creates_a_migration_with_the_proper_name() {
1313
.run();
1414

1515
let expected_stdout = Regex::new("\
16-
Creating migrations/\\d{14}_hello/up.sql
17-
Creating migrations/\\d{14}_hello/down.sql\
16+
Creating migrations.\\d{14}_hello.up.sql
17+
Creating migrations.\\d{14}_hello.down.sql\
1818
").unwrap();
1919
assert!(result.is_success(), "Command failed: {:?}", result);
2020
assert!(expected_stdout.is_match(result.stdout()));
@@ -52,12 +52,12 @@ fn migration_version_can_be_specified_on_creation() {
5252
.arg("--version=1234")
5353
.run();
5454

55-
let expected_stdout = "\
56-
Creating migrations/1234_hello/up.sql
57-
Creating migrations/1234_hello/down.sql
58-
";
55+
let expected_stdout = Regex::new("\
56+
Creating migrations.1234_hello.up.sql
57+
Creating migrations.1234_hello.down.sql
58+
").unwrap();
5959
assert!(result.is_success(), "Command failed: {:?}", result);
60-
assert_eq!(expected_stdout, result.stdout());
60+
assert!(expected_stdout.is_match(result.stdout()));
6161

6262
assert!(p.has_file("migrations/1234_hello/up.sql"));
6363
assert!(p.has_file("migrations/1234_hello/down.sql"));
@@ -75,12 +75,12 @@ fn migration_directory_can_be_specified_for_generate_by_command_line_arg() {
7575
.arg("--migration-dir=foo")
7676
.run();
7777

78-
let expected_stdout = "\
79-
Creating foo/12345_stuff/up.sql
80-
Creating foo/12345_stuff/down.sql
81-
";
78+
let expected_stdout = Regex::new("\
79+
Creating foo.12345_stuff.up.sql
80+
Creating foo.12345_stuff.down.sql
81+
").unwrap();
8282
assert!(result.is_success(), "Command failed: {:?}", result);
83-
assert_eq!(expected_stdout, result.stdout());
83+
assert!(expected_stdout.is_match(result.stdout()));
8484

8585
assert!(p.has_file("foo/12345_stuff/up.sql"));
8686
assert!(p.has_file("foo/12345_stuff/down.sql"));
@@ -98,12 +98,12 @@ fn migration_directory_can_be_specified_for_generate_by_env_var() {
9898
.env("MIGRATION_DIRECTORY", "bar")
9999
.run();
100100

101-
let expected_stdout = "\
102-
Creating bar/12345_stuff/up.sql
103-
Creating bar/12345_stuff/down.sql
104-
";
101+
let expected_stdout = Regex::new("\
102+
Creating bar.12345_stuff.up.sql
103+
Creating bar.12345_stuff.down.sql
104+
").unwrap();
105105
assert!(result.is_success(), "Command failed: {:?}", result);
106-
assert_eq!(expected_stdout, result.stdout());
106+
assert!(expected_stdout.is_match(result.stdout()));
107107

108108
assert!(p.has_file("bar/12345_stuff/up.sql"));
109109
assert!(p.has_file("bar/12345_stuff/down.sql"));

0 commit comments

Comments
 (0)