Files
swift-mirror/test/stdlib/Assert.swift
Dmitri Hrybenko 4277cfa89e Add tests for assertion routines
Also use Console.write() to print the assertion message because it uses
write(2) without buffering.


Swift SVN r5943
2013-07-01 19:58:07 +00:00

14 lines
312 B
Swift

// RUN: %swift -i %s 2>&1 | FileCheck %s
func test_alwaysTrap() {
var x = 2
alwaysTrap(x * 21 == 42, "should not fail")
con.write("OK")
// CHECK: OK
alwaysTrap(x == 42, "this should fail")
// CHECK: assertion failed: this should fail: file {{.*}}Assert.swift, line [[@LINE-1]]
}
test_alwaysTrap()