More test fixes.

Review URL: https://codereview.chromium.org//13749009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21090 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
floitsch@google.com 2013-04-08 17:35:39 +00:00
parent f0fac32cfb
commit 2a9ddbc93d
3 changed files with 33 additions and 2 deletions

View file

@ -11,12 +11,15 @@ const lazy = const DeferredLibrary('deferred_class_library');
isNoSuchMethodError(e) => e is NoSuchMethodError;
class Expect {
static void isTrue(x) => expect.equals(true, x);
static void isTrue(x) => Expect.equals(true, x);
static void isFalse(x) => Expect.equals(false, x);
static void equals(expected, actual) {
if (expected != actual) {
throw "Not equal. Expected: $expected. Got: $actual";
}
}
static void throws(fun, [test]) {
try {
fun();
@ -26,6 +29,8 @@ class Expect {
}
throw "didn't throw";
}
static void isNull(x) => expect.equals(null, x);
}
main() {

View file

@ -8,6 +8,29 @@ import 'dart:async';
const lazy = const DeferredLibrary('deferred_class_library');
class Expect {
static void isTrue(x) => Expect.equals(true, x);
static void isFalse(x) => Expect.equals(false, x);
static void equals(expected, actual) {
if (expected != actual) {
throw "Not equal. Expected: $expected. Got: $actual";
}
}
static void throws(fun, [test]) {
try {
fun();
} catch (e) {
if (!test(e)) throw "doesn't satisfy exception test";
return;
}
throw "didn't throw";
}
static void isNull(x) => expect.equals(null, x);
}
main() {
var x;
// TODO(ahe): What are the semantics of this:

View file

@ -13,7 +13,10 @@ const lazy = const DeferredLibrary('deferred_function_library');
isNoSuchMethodError(e) => e is NoSuchMethodError;
class Expect {
static void isTrue(x) => expect.equals(true, x);
static void isTrue(x) => Expect.equals(true, x);
static void isFalse(x) => Expect.equals(true, x);
static void equals(expected, actual) {
if (expected != actual) {
throw "Not equal. Expected: $expected. Got: $actual";