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

Unified Diff: test/codegen/expect/corelib/iterable_take_while_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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 | « test/codegen/expect/corelib/iterable_take_test.js ('k') | test/codegen/expect/corelib/iterable_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/expect/corelib/iterable_take_while_test.js
diff --git a/test/codegen/expect/corelib/iterable_take_while_test.js b/test/codegen/expect/corelib/iterable_take_while_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d89a33a0597f3e0a9026e3257bc2da19d3818a64
--- /dev/null
+++ b/test/codegen/expect/corelib/iterable_take_while_test.js
@@ -0,0 +1,136 @@
+dart_library.library('corelib/iterable_take_while_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__iterable_take_while_test(exports, dart_sdk, expect) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const _interceptors = dart_sdk._interceptors;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const iterable_take_while_test = Object.create(null);
+ let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(core.int)))();
+ let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
+ let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))();
+ let IterableOfint = () => (IterableOfint = dart.constFn(core.Iterable$(core.int)))();
+ let intTobool = () => (intTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.int])))();
+ let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
+ let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ let const$;
+ iterable_take_while_test.main = function() {
+ let list1 = JSArrayOfint().of([1, 2, 3]);
+ let list2 = const$ || (const$ = dart.constList([4, 5], core.int));
+ let list3 = JSArrayOfString().of([]);
+ let set1 = SetOfint().new();
+ set1.add(11);
+ set1.add(12);
+ set1.add(13);
+ let set2 = core.Set.new();
+ let takeWhileFalse = list1[dartx.takeWhile](dart.fn(x => false, intTobool()));
+ let it = takeWhileFalse[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ let takeWhileOdd = list1[dartx.takeWhile](dart.fn(x => x[dartx.isOdd], intTobool()));
+ it = takeWhileOdd[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(1, it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ let takeWhileLessThan3 = list1[dartx.takeWhile](dart.fn(x => dart.notNull(x) < 3, intTobool()));
+ it = takeWhileLessThan3[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(1, it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(2, it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ let takeEverything = list1[dartx.takeWhile](dart.fn(x => true, intTobool()));
+ it = takeEverything[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(1, it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(2, it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(3, it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ let takeWhileEven = list1[dartx.takeWhile](dart.fn(x => x[dartx.isEven], intTobool()));
+ it = takeWhileFalse[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ takeWhileFalse = list2[dartx.takeWhile](dart.fn(x => false, intTobool()));
+ it = takeWhileFalse[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ takeWhileEven = list2[dartx.takeWhile](dart.fn(x => x[dartx.isEven], intTobool()));
+ it = takeWhileEven[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(4, it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ takeEverything = list2[dartx.takeWhile](dart.fn(x => true, intTobool()));
+ it = takeEverything[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(4, it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(5, it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ let takeWhileFalse2 = list3[dartx.takeWhile](dart.fn(x => false, StringTobool()));
+ let it2 = takeWhileFalse2[dartx.iterator];
+ expect$.Expect.isNull(it2.current);
+ expect$.Expect.isFalse(it2.moveNext());
+ expect$.Expect.isNull(it2.current);
+ let takeEverything2 = list3[dartx.takeWhile](dart.fn(x => true, StringTobool()));
+ it2 = takeEverything2[dartx.iterator];
+ expect$.Expect.isNull(it2.current);
+ expect$.Expect.isFalse(it2.moveNext());
+ expect$.Expect.isNull(it2.current);
+ takeWhileFalse = set1.takeWhile(dart.fn(x => false, intTobool()));
+ it = takeWhileFalse[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ takeEverything = set1.takeWhile(dart.fn(x => true, intTobool()));
+ let copied = takeEverything[dartx.toList]();
+ expect$.Expect.equals(3, copied[dartx.length]);
+ expect$.Expect.isTrue(set1.contains(copied[dartx.get](0)));
+ expect$.Expect.isTrue(set1.contains(copied[dartx.get](1)));
+ expect$.Expect.isTrue(set1.contains(copied[dartx.get](1)));
+ expect$.Expect.isTrue(copied[dartx.get](0) != copied[dartx.get](1));
+ expect$.Expect.isTrue(copied[dartx.get](0) != copied[dartx.get](2));
+ expect$.Expect.isTrue(copied[dartx.get](1) != copied[dartx.get](2));
+ it = takeEverything[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.isTrue(it.current != null);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.isTrue(it.current != null);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.isTrue(it.current != null);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ takeWhileFalse = IterableOfint()._check(set2.takeWhile(dart.fn(x => false, dynamicTobool())));
+ it = takeWhileFalse[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ takeEverything = IterableOfint()._check(set2.takeWhile(dart.fn(x => true, dynamicTobool())));
+ it = takeEverything[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ };
+ dart.fn(iterable_take_while_test.main, VoidTodynamic());
+ // Exports:
+ exports.iterable_take_while_test = iterable_take_while_test;
+});
« no previous file with comments | « test/codegen/expect/corelib/iterable_take_test.js ('k') | test/codegen/expect/corelib/iterable_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698