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

Unified Diff: dart/tests/compiler/dart2js_foreign/native_checked_fields_test.dart

Issue 23477028: Remove dart2js_foreign. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: dart/tests/compiler/dart2js_foreign/native_checked_fields_test.dart
diff --git a/dart/tests/compiler/dart2js_foreign/native_checked_fields_test.dart b/dart/tests/compiler/dart2js_foreign/native_checked_fields_test.dart
deleted file mode 100644
index 91406f36073343c206af6f4e2119611240276b3e..0000000000000000000000000000000000000000
--- a/dart/tests/compiler/dart2js_foreign/native_checked_fields_test.dart
+++ /dev/null
@@ -1,120 +0,0 @@
-// 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.
-
-// Test that type checks occur on assignment to fields of native methods.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
- int foo;
-}
-
-@Native("*B")
-class B {
- String foo;
-}
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native("""
-function A() {}
-
-function B() {}
-
-makeA = function(){return new A;};
-makeB = function(){return new B;};
-""")
-void setup();
-
-expectThrows(action()) {
- bool threw = false;
- try {
- action();
- } catch (e) {
- threw = true;
- }
- Expect.isTrue(threw);
-}
-
-checkedModeTest() {
- var things = [makeA(), makeB()];
- var a = things[0];
- var b = things[1];
-
- a.foo = 123;
- expectThrows(() => a.foo = 'xxx');
- Expect.equals(123, a.foo);
-
- b.foo = 'hello';
- expectThrows(() => b.foo = 123);
- Expect.equals('hello', b.foo);
-
- // Check that we throw the same errors when the locals are typed.
- A aa = things[0];
- B bb = things[1];
-
- aa.foo = 124;
- expectThrows(() => aa.foo = 'xxx');
- Expect.equals(124, aa.foo);
-
- bb.foo = 'hello';
- expectThrows(() => bb.foo = 124);
- Expect.equals('hello', bb.foo);
-}
-
-uncheckedModeTest() {
- var things = [makeA(), makeB()];
- var a = things[0];
- var b = things[1];
-
- a.foo = 123;
- Expect.equals(123, a.foo);
- a.foo = 'xxx';
- Expect.equals('xxx', a.foo);
-
- b.foo = 'hello';
- Expect.equals('hello', b.foo);
- b.foo = 123;
- Expect.equals(b.foo, 123);
-
- // Check that we do not throw errors when the locals are typed.
- A aa = things[0];
- B bb = things[1];
-
- aa.foo = 124;
- Expect.equals(124, aa.foo);
- a.foo = 'yyy';
- Expect.equals('yyy', a.foo);
-
- b.foo = 'hello';
- Expect.equals('hello', b.foo);
- b.foo = 124;
- Expect.equals(b.foo, 124);
-}
-
-bool isCheckedMode() {
- var stuff = [1, 'string'];
- var a = stuff[0];
- // Checked-mode detection.
- try {
- String s = a;
- return false;
- } catch (e) {
- // Ignore.
- }
- return true;
-}
-
-main() {
- setup();
-
- if (isCheckedMode()) {
- checkedModeTest();
- } else {
- uncheckedModeTest();
- }
-}

Powered by Google App Engine
This is Rietveld 408576698