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

Unified Diff: tests/language/interface_factory_test.dart

Issue 11434089: Update or delete language tests using obsolete interfaces or default factory (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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: tests/language/interface_factory_test.dart
===================================================================
--- tests/language/interface_factory_test.dart (revision 15648)
+++ tests/language/interface_factory_test.dart (working copy)
@@ -1,69 +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.
-//
-// Test that the two major variations of interface factories work.
-
-// Variant 1. The factory class implements the interface and provides
-// a default implementation of the interface.
-
-interface Interface1 default DefaultImplementation {
- // first parameter type 'var' not a subtype of 'int' in default implementation
- Interface1(var secret); /// static type warning
- Interface1.named();
-
- GetSecret();
-}
-
-class DefaultImplementation implements Interface1 {
- int _secret;
-
- DefaultImplementation(int this._secret) {}
- DefaultImplementation.named() : this._secret = 11 {}
-
- int GetSecret() { return _secret; }
-
- static testMain() {
- Expect.equals(7, new Interface1(7).GetSecret());
- Expect.equals(11, new Interface1.named().GetSecret());
- }
-}
-
-// Variant 2. The factory class provides factory constructors for the
-// interface.
-
-interface Interface2 default FactoryProvider {
- Interface2(var secret);
- Interface2.named();
-
- GetSecret();
-}
-
-class SomeImplementation implements Interface2 {
- String _secret;
-
- SomeImplementation(String one, String two) : _secret = "${one}${two}" {}
-
- String GetSecret() { return _secret; }
-}
-
-// Note that FactoryProvider does not implement Interface2.
-class FactoryProvider {
- factory Interface2(var secret) {
- return new SomeImplementation(secret, secret);
- }
-
- factory Interface2.named() {
- return new SomeImplementation("Named", "Constructor");
- }
-
- static testMain() {
- Expect.equals("cobracobra", new Interface2("cobra").GetSecret());
- Expect.equals("NamedConstructor", new Interface2.named().GetSecret());
- }
-}
-
-main() {
- DefaultImplementation.testMain();
- FactoryProvider.testMain();
-}
« no previous file with comments | « tests/language/interface_factory_multi_test.dart ('k') | tests/language/interface_function_type_alias1_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698