Files
swift-mirror/test/Migrator/always_remove_old_remap_file.swift
David Farler b7ca27b38f [Migrator] Remove remap file for primary input at the start of migration
If a file is run through the migration workflow a second or third time,
but fails to compile in its current state in Swift 4, it might be possible
for the previous remap file to get picked up, resulting in the old changes
getting applied twice or at the wrong offsets. At the start of the migration,
proactively remove the remap file to prevent this.

rdar://problem/32545844
2017-06-14 14:21:51 -07:00

14 lines
764 B
Swift

// RUN: rm -rf %t && mkdir -p %t && cp %s %t/input.swift
// RUN: %target-swift-frontend -c -update-code -primary-file %t/input.swift -emit-migrated-file-path %t/always_remove_old_remap_file.result -emit-remap-file-path %t/always_remove_old_remap_file.remap -o /dev/null
// RUN: ls %t/always_remove_old_remap_file.remap
// Simulate leaving behind code that can't build in Swift 4:
// RUN: echo asdfads >> %t/input.swift
// Migrate again. This should delete the old remap file.
// RUN: not %target-swift-frontend -c -update-code -primary-file %t/input.swift -emit-migrated-file-path %t/always_remove_old_remap_file.result -emit-remap-file-path %t/always_remove_old_remap_file.remap -o /dev/null
// RUN: not ls %t/always_remove_old_remap_file.remap
func foo() {}