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

Side by Side Diff: tests/language/src/OperatorIndexEvaluationOrderTest.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
« no previous file with comments | « tests/language/src/Operator4Test.dart ('k') | tests/language/src/OperatorTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 class B {
6 int value;
7 List trace;
8 B(this.trace) : value = 100;
9 operator [](index) {
10 trace.add(-3);
11 trace.add(index);
12 trace.add(this.value);
13 this.value = this.value + 1;
14 return this;
15 }
16
17 operator []=(index, value) {
18 trace.add(-5);
19 trace.add(index);
20 trace.add(value.value);
21 this.value = this.value + 1;
22 }
23
24 operator +(int value) {
25 trace.add(-4);
26 trace.add(this.value);
27 trace.add(value);
28 this.value = this.value + 1;
29 return this;
30 }
31 }
32
33 B getB(trace) {
34 trace.add(-1);
35 return new B(trace);
36 }
37
38 int getIndex(trace) {
39 trace.add(-2);
40 return 42;
41 }
42
43 main() {
44 List trace = new List();
45 getB(trace)[getIndex(trace)] += 37;
46
47 Expect.listEquals([-1, -2, -3, 42, 100, -4, 101, 37, -5, 42, 102], trace);
48 }
OLDNEW
« no previous file with comments | « tests/language/src/Operator4Test.dart ('k') | tests/language/src/OperatorTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698