Bug 1407967 - Fix comparison checks in lz4 tests incorrectly comparing arrays to themselves. r?Yoric
MozReview-Commit-ID: GBfydwjXPcw
--- 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");