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

Side by Side Diff: tests/language/src/InterfaceFactoryMultiTest.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, 7 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
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4 //
5
6 // Test that a factory provider can provide for more than one interface.
7
8 interface A default F {
9 A(var secret);
10
11 GetSecret();
12 }
13
14 class AImpl implements A {
15 String _secret;
16
17 AImpl(String one, String two) : _secret = "${one}${two}";
18
19 String GetSecret() { return _secret; }
20 }
21
22 interface B default F {
23 B(var secret);
24
25 GetSecret();
26 }
27
28 class BImpl implements B {
29 String _secret;
30
31 BImpl(String one, String two) : _secret = "${two}${one}";
32
33 String GetSecret() { return _secret; }
34 }
35
36
37 // One factory provider for two interfaces.
38 class F {
39 factory A(var secret) {
40 return new AImpl(secret, 'A');
41 }
42
43 factory B(var secret) {
44 return new BImpl(secret, 'B');
45 }
46 }
47
48 main() {
49 Expect.equals('1A', new A('1').GetSecret());
50 Expect.equals('B2', new B('2').GetSecret());
51 }
OLDNEW
« no previous file with comments | « tests/language/src/InterfaceFactoryConstructorNegativeTest.dart ('k') | tests/language/src/InterfaceFactoryTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698