Skip to content

Commit 88167e7

Browse files
committed
[test] diff --strip-trailing-cr is non-standard.
This flag is a GNU extension, and would cause misleading test failures on other platforms where this extension is not available. However, the necessity to switch line endings is only required on Windows when testing. We could use sed to canonicalize line endings before comparing, but that may cause higher amounts of filesystem traffic on Windows which would slow down testing. Instead, move the substitution for diff in SourceKit's lit.local.cfg up to the top level, and conditionalize the substitution which has the flag on Windows, but not on other platforms (where it should not be required).
1 parent 1298f71 commit 88167e7

14 files changed

+17
-13
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 --strip-trailing-cr -u %s.expected %t/double_fixit_ok.result
3+
// RUN: %diff -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 --strip-trailing-cr -u %s.expected %t/double_fixit_ok.result
3+
// RUN: %diff -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 --strip-trailing-cr -u %s.expected %t/result.swift
3+
// RUN: %diff -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 --strip-trailing-cr -u %s.expected %t/result.swift
3+
// RUN: %diff -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 --strip-trailing-cr -u %s.expected %t/no_extraneous_argument_labels.result
3+
// RUN: %diff -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 --strip-trailing-cr -u %s.expected %t/no_extraneous_argument_labels.result
3+
// RUN: %diff -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 --strip-trailing-cr -u %s %t/no_var_to_let.swift.result
4+
// RUN: %diff -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 --strip-trailing-cr -u %s %t/migrated_null_migration.swift
2+
// RUN: %diff -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: 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 -c -swift-version 4 -primary-file %s -emit-migrated-file-path %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
3+
// RUN: %diff -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
44

55
func fetchOptInt() throws -> Int? {
66
return 3

test/Migrator/optional_try_migration.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 -c -swift-version 4 -primary-file %s -emit-migrated-file-path %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
3+
// RUN: %diff -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
44

55
func fetchOptInt() throws -> Int? {
66
return 3

0 commit comments

Comments
 (0)