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

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

Issue 383413003: Add @Native(...) annotation for native class names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 5 months 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 | Annotate | Revision Log
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 'dart:_foreign_helper' show JS;
10 10 import 'dart:_js_helper';
11 import "package:expect/expect.dart"; 11 import 'package:expect/expect.dart';
12 12
13 main() { 13 main() {
14 var previous; 14 var previous;
15 check(e) { 15 check(e) {
16 print('$e'); 16 print('$e');
17 Expect.equals(e, e); 17 Expect.equals(e, e);
18 Expect.notEquals(e, new Object()); 18 Expect.notEquals(e, new Object());
19 Expect.notEquals(e, previous); 19 Expect.notEquals(e, previous);
20 previous = e; 20 previous = e;
21 return '$e' != '[object Object]'; 21 return '$e' != '[object Object]';
22 } 22 }
23 Expect.throws(() { JS('void', 'noGlobalVariableWithThisName'); }, check); 23 Expect.throws(() { JS('void', 'noGlobalVariableWithThisName'); }, check);
24 Expect.throws(() { JS('void', 'throw 3'); }, check); 24 Expect.throws(() { JS('void', 'throw 3'); }, check);
25 Expect.throws( 25 Expect.throws(
26 () { 26 () {
27 JS('bool', 'Object.prototype.hasOwnProperty.call(undefined, "foo")'); 27 JS('bool', 'Object.prototype.hasOwnProperty.call(undefined, "foo")');
28 }, 28 },
29 check); 29 check);
30 Expect.throws(() { JS('void', 'throw new ReferenceError()'); }, check); 30 Expect.throws(() { JS('void', 'throw new ReferenceError()'); }, check);
31 Expect.throws(() { JS('void', 'throw void 0'); }, check); 31 Expect.throws(() { JS('void', 'throw void 0'); }, check);
32 Expect.throws(() { JS('void', 'throw "a string"'); }, check); 32 Expect.throws(() { JS('void', 'throw "a string"'); }, check);
33 Expect.throws(() { JS('void', 'throw null'); }, check); 33 Expect.throws(() { JS('void', 'throw null'); }, check);
34 } 34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698