Index: tests/language/src/AssertionTest.dart |
=================================================================== |
--- tests/language/src/AssertionTest.dart (revision 409) |
+++ tests/language/src/AssertionTest.dart (working copy) |
@@ -1,48 +1,43 @@ |
// 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 |
+// VMOptions=--enable_type_checks |
ahe
2011/10/14 10:45:40
I don't think this option belongs in language test
jat
2011/10/14 14:46:54
It is also understood by Dartc to do the same thin
|
// |
// Dart test program testing assert statements. |
-class AssertTest { |
+class AssertionTest { |
static test() { |
int i = 0; |
try { |
assert(false); |
- } catch (AssertError error) { |
+ } catch (AssertionError error) { |
i = 1; |
- Expect.equals("false", error.failedAssertion); |
- int pos = error.url.lastIndexOf("/", error.url.length); |
- if (pos == -1) { |
- pos = error.url.lastIndexOf("\\", error.url.length); |
- } |
- String subs = error.url.substring(pos + 1, error.url.length); |
- Expect.equals("AssertTest.dart", subs); |
- Expect.equals(12, error.line); |
- Expect.equals(14, error.column); |
regis
2011/10/14 20:40:28
John, please do not remove valid testing of the vm
jat
2011/10/14 20:44:46
The test does not match the spec, so it seems reas
regis
2011/10/14 21:04:41
We are in agreement. I am not against renaming the
|
} |
return i; |
} |
+ |
static testClosure() { |
int i = 0; |
try { |
assert(() => false); |
- } catch (AssertError error) { |
+ } catch (AssertionError error) { |
i = 1; |
- Expect.equals("() => false", error.failedAssertion); |
- int pos = error.url.lastIndexOf("/", error.url.length); |
- if (pos == -1) { |
- pos = error.url.lastIndexOf("\\", error.url.length); |
- } |
- String subs = error.url.substring(pos + 1, error.url.length); |
- Expect.equals("AssertTest.dart", subs); |
- Expect.equals(30, error.line); |
- Expect.equals(14, error.column); |
} |
return i; |
} |
+ static testClosure2() { |
ahe
2011/10/14 10:45:40
This method isn't called.
|
+ int i = 0; |
+ try { |
+ var x = () => false; |
+ assert(x); |
+ } catch (AssertionError error) { |
+ i = 1; |
+ } |
+ return i; |
+ } |
+ |
+ |
static testMain() { |
Expect.equals(1, test()); |
Expect.equals(1, testClosure()); |
ahe
2011/10/14 10:45:40
Could you add a few more test cases, for example:
|
@@ -50,5 +45,5 @@ |
} |
main() { |
- AssertTest.testMain(); |
+ AssertionTest.testMain(); |
} |