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

Unified Diff: test/codegen/expect/corelib/iterable_skip_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
Index: test/codegen/expect/corelib/iterable_skip_while_test.js
diff --git a/test/codegen/expect/corelib/iterable_skip_while_test.js b/test/codegen/expect/corelib/iterable_skip_while_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..533e81c7984289b41cecb58517eabbc18287853e
--- /dev/null
+++ b/test/codegen/expect/corelib/iterable_skip_while_test.js
@@ -0,0 +1,151 @@
+dart_library.library('corelib/iterable_skip_while_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__iterable_skip_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_skip_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_skip_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 skipWhileTrue = list1[dartx.skipWhile](dart.fn(x => true, intTobool()));
+ let it = skipWhileTrue[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ let skipWhileOdd = list1[dartx.skipWhile](dart.fn(x => x[dartx.isOdd], intTobool()));
+ it = skipWhileOdd[dartx.iterator];
+ expect$.Expect.isNull(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 skipWhileLessThan3 = list1[dartx.skipWhile](dart.fn(x => dart.notNull(x) < 3, intTobool()));
+ it = skipWhileLessThan3[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(3, it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ let skipWhileFalse = list1[dartx.skipWhile](dart.fn(x => false, intTobool()));
+ it = skipWhileFalse[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 skipWhileEven = list1[dartx.skipWhile](dart.fn(x => x[dartx.isEven], intTobool()));
+ it = skipWhileEven[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);
+ skipWhileTrue = list2[dartx.skipWhile](dart.fn(x => true, intTobool()));
+ it = skipWhileTrue[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ skipWhileEven = list2[dartx.skipWhile](dart.fn(x => x[dartx.isEven], intTobool()));
+ it = skipWhileEven[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isTrue(it.moveNext());
+ expect$.Expect.equals(5, it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ skipWhileOdd = list2[dartx.skipWhile](dart.fn(x => x[dartx.isOdd], intTobool()));
+ it = skipWhileOdd[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);
+ skipWhileFalse = list2[dartx.skipWhile](dart.fn(x => false, intTobool()));
+ it = skipWhileFalse[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 skipWhileFalse2 = list3[dartx.skipWhile](dart.fn(x => false, StringTobool()));
+ let it2 = skipWhileFalse2[dartx.iterator];
+ expect$.Expect.isNull(it2.current);
+ expect$.Expect.isFalse(it2.moveNext());
+ expect$.Expect.isNull(it2.current);
+ let skipWhileTrue2 = list3[dartx.skipWhile](dart.fn(x => true, StringTobool()));
+ it2 = skipWhileTrue2[dartx.iterator];
+ expect$.Expect.isNull(it2.current);
+ expect$.Expect.isFalse(it2.moveNext());
+ expect$.Expect.isNull(it2.current);
+ skipWhileTrue = set1.skipWhile(dart.fn(x => true, intTobool()));
+ it = skipWhileTrue[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ skipWhileFalse = set1.skipWhile(dart.fn(x => false, intTobool()));
+ let copied = skipWhileFalse[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 = skipWhileFalse[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);
+ skipWhileTrue = IterableOfint()._check(set2.skipWhile(dart.fn(x => true, dynamicTobool())));
+ it = skipWhileTrue[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ skipWhileFalse = IterableOfint()._check(set2.skipWhile(dart.fn(x => false, dynamicTobool())));
+ it = skipWhileFalse[dartx.iterator];
+ expect$.Expect.isNull(it.current);
+ expect$.Expect.isFalse(it.moveNext());
+ expect$.Expect.isNull(it.current);
+ };
+ dart.fn(iterable_skip_while_test.main, VoidTodynamic());
+ // Exports:
+ exports.iterable_skip_while_test = iterable_skip_while_test;
+});
« no previous file with comments | « test/codegen/expect/corelib/iterable_skip_test.js ('k') | test/codegen/expect/corelib/iterable_take_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698