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

Unified Diff: tests/language/src/InterfaceFactoryTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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: tests/language/src/InterfaceFactoryTest.dart
diff --git a/tests/language/src/InterfaceFactoryTest.dart b/tests/language/src/InterfaceFactoryTest.dart
deleted file mode 100644
index 5088db50091005448d6cb063a6cac014579afcc1..0000000000000000000000000000000000000000
--- a/tests/language/src/InterfaceFactoryTest.dart
+++ /dev/null
@@ -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/src/InterfaceFactoryMultiTest.dart ('k') | tests/language/src/InterfaceFunctionTypeAlias1NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698