Skip to content

Commit f12f0cc

Browse files
committed
test: adjust Migrator tests (NFCI)
This adjusts the test diffing to ignore the whitespace changes across different platforms. `raw_fd_ostream` will write out `OF_Text` files with the platform's line endings, which may differ from the source file's.
1 parent 6c29939 commit f12f0cc

12 files changed

+14
-14
lines changed

test/Migrator/double_fixit_ok.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: not %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t/double_fixit_ok.result -swift-version 4
3-
// RUN: diff -u %s.expected %t/double_fixit_ok.result
3+
// RUN: diff --strip-trailing-cr -u %s.expected %t/double_fixit_ok.result
44
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
55

66
@available(swift, obsoleted: 4, renamed: "Thing.constant___renamed")

test/Migrator/double_fixit_ok.swift.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: not %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t/double_fixit_ok.result -swift-version 4
3-
// RUN: diff -u %s.expected %t/double_fixit_ok.result
3+
// RUN: diff --strip-trailing-cr -u %s.expected %t/double_fixit_ok.result
44
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
55

66
@available(swift, obsoleted: 4, renamed: "Thing.constant___renamed")

test/Migrator/insert_replace_fixit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4
3-
// RUN: diff -u %s.expected %t/result.swift
3+
// RUN: diff --strip-trailing-cr -u %s.expected %t/result.swift
44

55
import TestMyTime
66

test/Migrator/insert_replace_fixit.swift.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4
3-
// RUN: diff -u %s.expected %t/result.swift
3+
// RUN: diff --strip-trailing-cr -u %s.expected %t/result.swift
44

55
import TestMyTime
66

test/Migrator/no_extraneous_argument_labels.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
22
// RUN: %empty-directory(%t) && %target-swift-frontend -c -primary-file %s -emit-migrated-file-path %t/no_extraneous_argument_labels.result -swift-version 4 -o /dev/null
3-
// RUN: diff -u %s.expected %t/no_extraneous_argument_labels.result
3+
// RUN: diff --strip-trailing-cr -u %s.expected %t/no_extraneous_argument_labels.result
44
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
55

66
func foo(_ oc: [String]) {

test/Migrator/no_extraneous_argument_labels.swift.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
22
// RUN: %empty-directory(%t) && %target-swift-frontend -c -primary-file %s -emit-migrated-file-path %t/no_extraneous_argument_labels.result -swift-version 4 -o /dev/null
3-
// RUN: diff -u %s.expected %t/no_extraneous_argument_labels.result
3+
// RUN: diff --strip-trailing-cr -u %s.expected %t/no_extraneous_argument_labels.result
44
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
55

66
func foo(_ oc: [String]) {

test/Migrator/no_var_to_let.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
22
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/no_var_to_let.swift.result -swift-version 4 -o /dev/null
33
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/no_var_to_let.swift.result -swift-version 4 -o /dev/null
4-
// RUN: diff -u %s %t/no_var_to_let.swift.result
4+
// RUN: diff --strip-trailing-cr -u %s %t/no_var_to_let.swift.result
55
// RUN: %target-swift-frontend -typecheck %s -swift-version 5
66

77
// Note that the diff run line indicates that there should be no change.

test/Migrator/null_migration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/migrated_null_migration.swift -emit-remap-file-path %t/null_migration.remap -o /dev/null
2-
// RUN: diff -u %s %t/migrated_null_migration.swift
2+
// RUN: diff --strip-trailing-cr -u %s %t/migrated_null_migration.swift
33

44
// This file tests that, if all migration passes are no-op,
55
// there are no changes to the file.

test/Migrator/optional_try_migration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -c -swift-version 4 -primary-file %s -emit-migrated-file-path %t/optional_try_migration.result.swift
3-
// RUN: diff -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
3+
// RUN: diff --strip-trailing-cr -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
44

55
func fetchOptInt() throws -> Int? {
66
return 3
@@ -109,4 +109,4 @@ func testCaseMatching() {
109109
if case let x? = try? fetchInt() {
110110
print(x)
111111
}
112-
}
112+
}

test/Migrator/optional_try_migration.swift.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -c -swift-version 4 -primary-file %s -emit-migrated-file-path %t/optional_try_migration.result.swift
3-
// RUN: diff -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
3+
// RUN: diff --strip-trailing-cr -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
44

55
func fetchOptInt() throws -> Int? {
66
return 3
@@ -109,4 +109,4 @@ func testCaseMatching() {
109109
if case let x? = try? fetchInt() {
110110
print(x)
111111
}
112-
}
112+
}

test/Migrator/post_fixit_pass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/post_fixit_pass.swift.result -o /dev/null -F %S/mock-sdk -swift-version 4
2-
// RUN: diff -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
2+
// RUN: diff --strip-trailing-cr -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
33

44
#if swift(>=4.2)
55
public struct SomeAttribute: RawRepresentable {

test/Migrator/post_fixit_pass.swift.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/post_fixit_pass.swift.result -o /dev/null -F %S/mock-sdk -swift-version 4
2-
// RUN: diff -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
2+
// RUN: diff --strip-trailing-cr -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
33

44
#if swift(>=4.2)
55
public struct SomeAttribute: RawRepresentable {

0 commit comments

Comments
 (0)