mirror of
https://github.com/dart-lang/sdk
synced 2024-10-02 02:31:50 +00:00
09bcdc6d6d
Remove non-compliant fields in various Error classes (issue 10144). Remove implicit constructor when patching in a constructor (issue 12217). Patch corelib Error classes instead of declaring subclasses. Update tests and status files. R=asiva@google.com, srdjan@google.com Review URL: https://codereview.chromium.org//21832003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25782 260f80e4-7a28-3924-810f-c04153c831b5
41 lines
1.1 KiB
Dart
41 lines
1.1 KiB
Dart
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
// VMOptions=--enable_asserts
|
|
|
|
// Dart test program testing assert statements.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class AssertTest {
|
|
static test() {
|
|
try {
|
|
assert(false);
|
|
Expect.fail("Assertion 'false' didn't fail.");
|
|
} on AssertionError catch (error) {
|
|
Expect.isTrue(error.toString().contains("'false'"));
|
|
Expect.isTrue(error.stackTrace.toString().contains(
|
|
"assert_test.dart:13:14"));
|
|
}
|
|
}
|
|
static testClosure() {
|
|
try {
|
|
assert(() => false);
|
|
Expect.fail("Assertion '() => false' didn't fail.");
|
|
} on AssertionError catch (error) {
|
|
Expect.isTrue(error.toString().contains("'() => false'"));
|
|
Expect.isTrue(error.stackTrace.toString().contains(
|
|
"assert_test.dart:23:14"));
|
|
}
|
|
}
|
|
|
|
static testMain() {
|
|
test();
|
|
testClosure();
|
|
}
|
|
}
|
|
|
|
main() {
|
|
AssertTest.testMain();
|
|
}
|