mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: not %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t/double_fixit_ok.result -swift-version 4
|
||||
// RUN: diff -u %s.expected %t/double_fixit_ok.result
|
||||
// RUN: diff --strip-trailing-cr -u %s.expected %t/double_fixit_ok.result
|
||||
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
|
||||
|
||||
@available(swift, obsoleted: 4, renamed: "Thing.constant___renamed")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: not %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t/double_fixit_ok.result -swift-version 4
|
||||
// RUN: diff -u %s.expected %t/double_fixit_ok.result
|
||||
// RUN: diff --strip-trailing-cr -u %s.expected %t/double_fixit_ok.result
|
||||
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
|
||||
|
||||
@available(swift, obsoleted: 4, renamed: "Thing.constant___renamed")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4
|
||||
// RUN: diff -u %s.expected %t/result.swift
|
||||
// RUN: diff --strip-trailing-cr -u %s.expected %t/result.swift
|
||||
|
||||
import TestMyTime
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4
|
||||
// RUN: diff -u %s.expected %t/result.swift
|
||||
// RUN: diff --strip-trailing-cr -u %s.expected %t/result.swift
|
||||
|
||||
import TestMyTime
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
|
||||
// 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
|
||||
// RUN: diff -u %s.expected %t/no_extraneous_argument_labels.result
|
||||
// RUN: diff --strip-trailing-cr -u %s.expected %t/no_extraneous_argument_labels.result
|
||||
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
|
||||
|
||||
func foo(_ oc: [String]) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
|
||||
// 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
|
||||
// RUN: diff -u %s.expected %t/no_extraneous_argument_labels.result
|
||||
// RUN: diff --strip-trailing-cr -u %s.expected %t/no_extraneous_argument_labels.result
|
||||
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
|
||||
|
||||
func foo(_ oc: [String]) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
|
||||
// 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
|
||||
// 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
|
||||
// RUN: diff -u %s %t/no_var_to_let.swift.result
|
||||
// RUN: diff --strip-trailing-cr -u %s %t/no_var_to_let.swift.result
|
||||
// RUN: %target-swift-frontend -typecheck %s -swift-version 5
|
||||
|
||||
// Note that the diff run line indicates that there should be no change.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 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
|
||||
// RUN: diff -u %s %t/migrated_null_migration.swift
|
||||
// RUN: diff --strip-trailing-cr -u %s %t/migrated_null_migration.swift
|
||||
|
||||
// This file tests that, if all migration passes are no-op,
|
||||
// there are no changes to the file.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -c -swift-version 4 -primary-file %s -emit-migrated-file-path %t/optional_try_migration.result.swift
|
||||
// RUN: diff -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
|
||||
// RUN: diff --strip-trailing-cr -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
|
||||
|
||||
func fetchOptInt() throws -> Int? {
|
||||
return 3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -c -swift-version 4 -primary-file %s -emit-migrated-file-path %t/optional_try_migration.result.swift
|
||||
// RUN: diff -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
|
||||
// RUN: diff --strip-trailing-cr -u %S/optional_try_migration.swift.expected %t/optional_try_migration.result.swift
|
||||
|
||||
func fetchOptInt() throws -> Int? {
|
||||
return 3
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 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
|
||||
// RUN: diff -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
|
||||
// RUN: diff --strip-trailing-cr -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
|
||||
|
||||
#if swift(>=4.2)
|
||||
public struct SomeAttribute: RawRepresentable {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 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
|
||||
// RUN: diff -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
|
||||
// RUN: diff --strip-trailing-cr -u %S/post_fixit_pass.swift.expected %t/post_fixit_pass.swift.result
|
||||
|
||||
#if swift(>=4.2)
|
||||
public struct SomeAttribute: RawRepresentable {
|
||||
|
||||
Reference in New Issue
Block a user