Bug 1407967 - Fix comparison checks in lz4 tests incorrectly comparing arrays to themselves. r?Yoric draft
authorMark Banner <standard8@mozilla.com>
Thu, 12 Oct 2017 12:23:03 +0100
changeset 679455 80900cb22141622dbfdefef7c583766860ed3905
parent 679173 bc7a5be76b723cf6aac1a919156e74997c5f4902
child 735601 4e1f7affe63048f717207d2dbd42cc5a1a6f24ed
push id84223
push userbmo:standard8@mozilla.com
push dateThu, 12 Oct 2017 17:29:03 +0000
reviewersYoric
bugs1407967
milestone58.0a1
Bug 1407967 - Fix comparison checks in lz4 tests incorrectly comparing arrays to themselves. r?Yoric MozReview-Commit-ID: GBfydwjXPcw
toolkit/components/lz4/tests/xpcshell/data/worker_lz4.js
toolkit/components/lz4/tests/xpcshell/test_lz4_sync.js
--- a/toolkit/components/lz4/tests/xpcshell/data/worker_lz4.js
+++ b/toolkit/components/lz4/tests/xpcshell/data/worker_lz4.js
@@ -68,17 +68,17 @@ function test_reference_file() {
   let path = OS.Path.join("data", "compression.lz");
   let data = OS.File.read(path);
   let decompressed = Lz4.decompressFileContent(data);
   let text = (new TextDecoder()).decode(decompressed);
   do_check_eq(text, "Hello, lz4");
 }
 
 function compare_arrays(a, b) {
-  return Array.prototype.join.call(a) == Array.prototype.join.call(a);
+  return Array.prototype.join.call(a) == Array.prototype.join.call(b);
 }
 
 function run_rawcompression(name, array) {
   do_print("Raw compression test " + name);
   let length = array.byteLength;
   let compressedArray = new Uint8Array(Internals.maxCompressedSize(length));
   let compressedBytes = Internals.compress(array, length, compressedArray);
   compressedArray = new Uint8Array(compressedArray.buffer, 0, compressedBytes);
--- a/toolkit/components/lz4/tests/xpcshell/test_lz4_sync.js
+++ b/toolkit/components/lz4/tests/xpcshell/test_lz4_sync.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const Cu = Components.utils;
 Cu.import("resource://gre/modules/lz4.js");
 Cu.import("resource://gre/modules/osfile.jsm");
 
 function compare_arrays(a, b) {
-  return Array.prototype.join.call(a) == Array.prototype.join.call(a);
+  return Array.prototype.join.call(a) == Array.prototype.join.call(b);
 }
 
 add_task(async function() {
   let path = OS.Path.join("data", "compression.lz");
   let data = await OS.File.read(path);
   let decompressed = Lz4.decompressFileContent(data);
   let text = (new TextDecoder()).decode(decompressed);
   do_check_eq(text, "Hello, lz4");