Created
March 20, 2018 02:45
-
-
Save erica/27fe5d738d9f1698b1773f18ff99141e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% cat testAssertConfigurations.swift | |
// Test compilation with -O, -Onone, and -Ounchecked | |
print("Starting tests") | |
#if optimization(enabled) | |
print("asserts will not fire. optimized") | |
#else | |
print("asserts will fire. unoptimized/debug") | |
#endif | |
#if !optimization(enabled) | |
print("asserts will fire. unoptimized/debug") | |
#else | |
print("asserts will not fire. optimized") | |
#endif | |
print("Ending tests") | |
% ./swift testAssertConfigurations.swift | |
Starting tests | |
asserts will fire. unoptimized/debug | |
asserts will fire. unoptimized/debug | |
Ending tests | |
% ./swift -O testAssertConfigurations.swift | |
Starting tests | |
asserts will not fire. optimized | |
asserts will not fire. optimized | |
Ending tests | |
% ./swift -Onone testAssertConfigurations.swift | |
Starting tests | |
asserts will fire. unoptimized/debug | |
asserts will fire. unoptimized/debug | |
Ending tests | |
% ./swift -Ounchecked testAssertConfigurations.swift | |
Starting tests | |
asserts will not fire. optimized | |
asserts will not fire. optimized | |
Ending tests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment