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

Unified Diff: tests/language/void_type_test.dart

Issue 10784020: Revert fix for type checking of void type, because some top level tests fail. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/type_vm_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/void_type_test.dart
===================================================================
--- tests/language/void_type_test.dart (revision 9672)
+++ tests/language/void_type_test.dart (working copy)
@@ -1,84 +0,0 @@
-// Copyright (c) 2012, 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.
-// Dart test for type checks involving the void type.
-
-isCheckedMode() {
- try {
- var i = 1;
- String s = i;
- return false;
- } catch(var e) {
- return true;
- }
-}
-
-void f() { return; }
-
-void f_null() { return null; }
-
-void f_1() { return 1; }
-
-void f_dyn_null() {
- var x = null;
- return x;
-}
-
-void f_dyn_1() {
- var x = 1;
- return x;
-}
-
-void f_f() { return f(); }
-
-void test(int n, void func(), bool must_get_error) {
- // Test as closure call.
- {
- bool got_type_error = false;
- try {
- var x = func();
- } catch (TypeError error) {
- got_type_error = true;
- }
- // Never a type error in production mode.
- if (isCheckedMode()) {
- Expect.isTrue(got_type_error == must_get_error);
- } else {
- Expect.isFalse(got_type_error);
- }
- }
- // Test as direct call.
- {
- bool got_type_error = false;
- try {
- var x;
- switch (n) {
- case 0: x = f(); break;
- case 1: x = f_null(); break;
- case 2: x = f_1(); break;
- case 3: x = f_dyn_null(); break;
- case 4: x = f_dyn_1(); break;
- case 5: x = f_f(); break;
- }
- } catch (TypeError error) {
- got_type_error = true;
- }
- // Never a type error in production mode.
- if (isCheckedMode()) {
- Expect.isTrue(got_type_error == must_get_error);
- } else {
- Expect.isFalse(got_type_error);
- }
- }
-}
-
-main() {
- test(0, f, false);
- test(1, f_null, false);
- test(2, f_1, true);
- test(3, f_dyn_null, false);
- test(4, f_dyn_1, true);
- test(5, f_f, false);
-}
-
-
« no previous file with comments | « tests/language/type_vm_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698