Skip to content

test: adjust Migrator tests (NFCI) #29182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/Migrator/double_fixit_ok.swift
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/double_fixit_ok.swift.expected
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/insert_replace_fixit.swift
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/insert_replace_fixit.swift.expected
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/no_extraneous_argument_labels.swift
Original file line number Diff line number Diff line change
@@ -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]) {
Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/no_extraneous_argument_labels.swift.expected
Original file line number Diff line number Diff line change
@@ -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]) {
Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/no_var_to_let.swift
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/null_migration.swift
Original file line number Diff line number Diff line 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.
Expand Down
4 changes: 2 additions & 2 deletions test/Migrator/optional_try_migration.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -109,4 +109,4 @@ func testCaseMatching() {
if case let x? = try? fetchInt() {
print(x)
}
}
}
4 changes: 2 additions & 2 deletions test/Migrator/optional_try_migration.swift.expected
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -109,4 +109,4 @@ func testCaseMatching() {
if case let x? = try? fetchInt() {
print(x)
}
}
}
2 changes: 1 addition & 1 deletion test/Migrator/post_fixit_pass.swift
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion test/Migrator/post_fixit_pass.swift.expected
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down