Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: tests/compiler/dart2js_native/native_exception_test.dart

Issue 2379173002: Add native_testing library to mock @Native classes (Closed)
Patch Set: xxx Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test that dart2js can handle unexpected exception types. 5 // Test that dart2js can handle unexpected exception types.
6 6
7 library native_exception_test; 7 library native_exception_test;
8 8
9 import 'dart:_foreign_helper' show JS; 9 import 'native_testing.dart';
10 import 'dart:_js_helper';
11 import 'package:expect/expect.dart';
12 10
13 main() { 11 main() {
14 var previous; 12 var previous;
15 check(e) { 13 check(e) {
16 print('$e'); 14 print('$e');
17 Expect.equals(e, e); 15 Expect.equals(e, e);
18 Expect.notEquals(e, new Object()); 16 Expect.notEquals(e, new Object());
19 Expect.notEquals(e, previous); 17 Expect.notEquals(e, previous);
20 previous = e; 18 previous = e;
21 return '$e' != '[object Object]'; 19 return '$e' != '[object Object]';
(...skipping 14 matching lines...) Expand all
36 Expect.throws(() { 34 Expect.throws(() {
37 JS('void', 'throw void 0'); 35 JS('void', 'throw void 0');
38 }, check); 36 }, check);
39 Expect.throws(() { 37 Expect.throws(() {
40 JS('void', 'throw "a string"'); 38 JS('void', 'throw "a string"');
41 }, check); 39 }, check);
42 Expect.throws(() { 40 Expect.throws(() {
43 JS('void', 'throw null'); 41 JS('void', 'throw null');
44 }, check); 42 }, check);
45 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698