[PATCH 2/2] [PATCH 2/2] jscript_test: test Enumerator
Andreas Maier
staubim at quantentunnel.de
Mon Apr 15 14:26:42 CDT 2019
Signed-off-by: Andreas Maier <staubim at quantentunnel.de>
---
dlls/jscript/tests/extension.js | 64 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 dlls/jscript/tests/extension.js
diff --git a/dlls/jscript/tests/extension.js b/dlls/jscript/tests/extension.js
new file mode 100644
index 0000000000..92849097e9
--- /dev/null
+++ b/dlls/jscript/tests/extension.js
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2019 Andreas Maier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+var objdata = [];
+obj = new Enumerator(objdata);
+ok(obj.atEnd(), "atEnd() called before moveFirst should True!");
+
+
+var objdata = ["A","B"];
+obj = new Enumerator(objdata);
+ok(!obj.atEnd(), "atEnd() called before moveFirst should False!");
+ok(obj.item() === objdata[0],
+ "obj (Enumerator): item (called before moveFirst) value wrong! "+
+ "(is " + obj.item() + ", should " + objdata[0] + ")");
+obj.moveFirst();
+for (var i1 = 0; i1 < objdata.length; i1++)
+{
+ if (obj.atEnd())
+ {
+ ok(false, i1 + ": obj (Enumerator): to less items!");
+ break;
+ }
+ ok(obj.item() === objdata[i1],
+ i1 + ": obj (Enumerator): item value wrong! "+
+ "(is " + obj.item() + ", should " + objdata[i1] + ")");
+ obj.moveNext();
+}
+ok(obj.atEnd(), "obj (Enumerator): to much items!");
+
+/*
+todo_wine_ok(...
+-> activate if implemented ...
+var objdata = new ActiveXObject("Scripting.FileSystemObject").Drives;
+obj = new Enumerator(objdata);
+obj.moveFirst();
+for (var i1 = 0; i1 < objdata.Count; i1++)
+{
+ *//* Strings like "C:", "D:" ... *//*
+ DriveLetter = obj.item().Path;
+ ok(DriveLetter.length === 2,
+ "Expected driver-letter e.g. C:, D:, ... - wrong length "+DriveLetter.length);
+ ok(DriveLetter.charAt(1) === ":",
+ "Expected driver-letter e.g. C:, D:, ... - "+DriveLetter);
+ obj.moveNext();
+}
+ok(obj.atEnd(), "obj (Enumerator): to much items!");
+*/
+
+reportSuccess();
--
2.11.0
More information about the wine-devel
mailing list