Fix inconsistent spacing and trailing commas in objects in test/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on

http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing

Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.

Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.

```diff
diff --git a/test/chromium/test-telemetry.js b/test/chromium/test-telemetry.js
index cc412a31..2e5bdfa1 100755
--- a/test/chromium/test-telemetry.js
+++ b/test/chromium/test-telemetry.js
@@ -324,7 +324,7 @@ var tests = [
     var window = createExtensionGlobal();
     telemetryScript.runInNewContext(window);
     window.chrome.runtime.getManifest = function() {
-     return { version: '1.0.1', };
+      return { version: '1.0.1', };
     };
     window.Date.test_now_value += 12 * 36E5;
     telemetryScript.runInNewContext(window);
diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js
index 1f00747a..f22988e7 100644
--- a/test/unit/api_spec.js
+++ b/test/unit/api_spec.js
@@ -503,8 +503,9 @@ describe('api', function() {
     it('gets destinations, from /Dests dictionary', function(done) {
       var promise = doc.getDestinations();
       promise.then(function(data) {
-        expect(data).toEqual({ chapter1: [{ gen: 0, num: 17, }, { name: 'XYZ', },
-                                          0, 841.89, null], });
+        expect(data).toEqual({
+          chapter1: [{ gen: 0, num: 17, }, { name: 'XYZ', }, 0, 841.89, null],
+        });
         done();
       }).catch(function (reason) {
         done.fail(reason);
diff --git a/test/unit/function_spec.js b/test/unit/function_spec.js
index 66441212..62127eb9 100644
--- a/test/unit/function_spec.js
+++ b/test/unit/function_spec.js
@@ -492,9 +492,11 @@ describe('function', function() {
     it('check compiled mul', function() {
       check([0.25, 0.5, 'mul'], [], [0, 1], [{ input: [], output: [0.125], }]);
       check([0, 'mul'], [0, 1], [0, 1], [{ input: [0.25], output: [0], }]);
-      check([0.5, 'mul'], [0, 1], [0, 1], [{ input: [0.25], output: [0.125], }]);
+      check([0.5, 'mul'], [0, 1], [0, 1],
+            [{ input: [0.25], output: [0.125], }]);
       check([1, 'mul'], [0, 1], [0, 1], [{ input: [0.25], output: [0.25], }]);
-      check([0, 'exch', 'mul'], [0, 1], [0, 1], [{ input: [0.25], output: [0], }]);
+      check([0, 'exch', 'mul'], [0, 1], [0, 1],
+            [{ input: [0.25], output: [0], }]);
       check([0.5, 'exch', 'mul'], [0, 1], [0, 1],
             [{ input: [0.25], output: [0.125], }]);
       check([1, 'exch', 'mul'], [0, 1], [0, 1],
```
This commit is contained in:
Jonas Jenwald 2017-06-02 12:55:01 +02:00
parent 593dec1bb7
commit efbd68efef
19 changed files with 111 additions and 108 deletions

View file

@ -56,9 +56,9 @@ describe('function', function() {
}
}
return result;
}
},
};
}
},
});
});
@ -463,78 +463,80 @@ describe('function', function() {
}
it('check compiled add', function() {
check([0.25, 0.5, 'add'], [], [0, 1], [{input: [], output: [0.75]}]);
check([0, 'add'], [0, 1], [0, 1], [{input: [0.25], output: [0.25]}]);
check([0.5, 'add'], [0, 1], [0, 1], [{input: [0.25], output: [0.75]}]);
check([0.25, 0.5, 'add'], [], [0, 1], [{ input: [], output: [0.75], }]);
check([0, 'add'], [0, 1], [0, 1], [{ input: [0.25], output: [0.25], }]);
check([0.5, 'add'], [0, 1], [0, 1], [{ input: [0.25], output: [0.75], }]);
check([0, 'exch', 'add'], [0, 1], [0, 1],
[{input: [0.25], output: [0.25]}]);
[{ input: [0.25], output: [0.25], }]);
check([0.5, 'exch', 'add'], [0, 1], [0, 1],
[{input: [0.25], output: [0.75]}]);
[{ input: [0.25], output: [0.75], }]);
check(['add'], [0, 1, 0, 1], [0, 1],
[{input: [0.25, 0.5], output: [0.75]}]);
[{ input: [0.25, 0.5], output: [0.75], }]);
check(['add'], [0, 1], [0, 1], null);
});
it('check compiled sub', function() {
check([0.5, 0.25, 'sub'], [], [0, 1], [{input: [], output: [0.25]}]);
check([0, 'sub'], [0, 1], [0, 1], [{input: [0.25], output: [0.25]}]);
check([0.5, 'sub'], [0, 1], [0, 1], [{input: [0.75], output: [0.25]}]);
check([0.5, 0.25, 'sub'], [], [0, 1], [{ input: [], output: [0.25], }]);
check([0, 'sub'], [0, 1], [0, 1], [{ input: [0.25], output: [0.25], }]);
check([0.5, 'sub'], [0, 1], [0, 1], [{ input: [0.75], output: [0.25], }]);
check([0, 'exch', 'sub'], [0, 1], [-1, 1],
[{input: [0.25], output: [-0.25]}]);
[{ input: [0.25], output: [-0.25], }]);
check([0.75, 'exch', 'sub'], [0, 1], [-1, 1],
[{input: [0.25], output: [0.5]}]);
[{ input: [0.25], output: [0.5], }]);
check(['sub'], [0, 1, 0, 1], [-1, 1],
[{input: [0.25, 0.5], output: [-0.25]}]);
[{ input: [0.25, 0.5], output: [-0.25], }]);
check(['sub'], [0, 1], [0, 1], null);
check([1, 'dup', 3, 2, 'roll', 'sub', 'sub'], [0, 1], [0, 1],
[{input: [0.75], output: [0.75]}]);
[{ input: [0.75], output: [0.75], }]);
});
it('check compiled mul', function() {
check([0.25, 0.5, 'mul'], [], [0, 1], [{input: [], output: [0.125]}]);
check([0, 'mul'], [0, 1], [0, 1], [{input: [0.25], output: [0]}]);
check([0.5, 'mul'], [0, 1], [0, 1], [{input: [0.25], output: [0.125]}]);
check([1, 'mul'], [0, 1], [0, 1], [{input: [0.25], output: [0.25]}]);
check([0, 'exch', 'mul'], [0, 1], [0, 1], [{input: [0.25], output: [0]}]);
check([0.25, 0.5, 'mul'], [], [0, 1], [{ input: [], output: [0.125], }]);
check([0, 'mul'], [0, 1], [0, 1], [{ input: [0.25], output: [0], }]);
check([0.5, 'mul'], [0, 1], [0, 1],
[{ input: [0.25], output: [0.125], }]);
check([1, 'mul'], [0, 1], [0, 1], [{ input: [0.25], output: [0.25], }]);
check([0, 'exch', 'mul'], [0, 1], [0, 1],
[{ input: [0.25], output: [0], }]);
check([0.5, 'exch', 'mul'], [0, 1], [0, 1],
[{input: [0.25], output: [0.125]}]);
[{ input: [0.25], output: [0.125], }]);
check([1, 'exch', 'mul'], [0, 1], [0, 1],
[{input: [0.25], output: [0.25]}]);
[{ input: [0.25], output: [0.25], }]);
check(['mul'], [0, 1, 0, 1], [0, 1],
[{input: [0.25, 0.5], output: [0.125]}]);
[{ input: [0.25, 0.5], output: [0.125], }]);
check(['mul'], [0, 1], [0, 1], null);
});
it('check compiled max', function() {
check(['dup', 0.75, 'gt', 7, 'jz', 'pop', 0.75], [0, 1], [0, 1],
[{input: [0.5], output: [0.5]}]);
[{ input: [0.5], output: [0.5], }]);
check(['dup', 0.75, 'gt', 7, 'jz', 'pop', 0.75], [0, 1], [0, 1],
[{input: [1], output: [0.75]}]);
[{ input: [1], output: [0.75], }]);
check(['dup', 0.75, 'gt', 5, 'jz', 'pop', 0.75], [0, 1], [0, 1], null);
});
it('check pop/roll/index', function() {
check([1, 'pop'], [0, 1], [0, 1], [{input: [0.5], output: [0.5]}]);
check([1, 'pop'], [0, 1], [0, 1], [{ input: [0.5], output: [0.5], }]);
check([1, 3, -1, 'roll'], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1],
[{input: [0.25, 0.5], output: [0.5, 1, 0.25]}]);
[{ input: [0.25, 0.5], output: [0.5, 1, 0.25], }]);
check([1, 3, 1, 'roll'], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1],
[{input: [0.25, 0.5], output: [1, 0.25, 0.5]}]);
[{ input: [0.25, 0.5], output: [1, 0.25, 0.5], }]);
check([1, 3, 1.5, 'roll'], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1], null);
check([1, 1, 'index'], [0, 1], [0, 1, 0, 1, 0, 1],
[{input: [0.5], output: [0.5, 1, 0.5]}]);
[{ input: [0.5], output: [0.5, 1, 0.5], }]);
check([1, 3, 'index', 'pop'], [0, 1], [0, 1], null);
check([1, 0.5, 'index', 'pop'], [0, 1], [0, 1], null);
});
it('check input boundaries', function () {
check([], [0, 0.5], [0, 1], [{input: [1], output: [0.5]}]);
check([], [0.5, 1], [0, 1], [{input: [0], output: [0.5]}]);
check([], [0, 0.5], [0, 1], [{ input: [1], output: [0.5], }]);
check([], [0.5, 1], [0, 1], [{ input: [0], output: [0.5], }]);
check(['dup'], [0.5, 0.75], [0, 1, 0, 1],
[{input: [0], output: [0.5, 0.5]}]);
check([], [100, 1001], [0, 10000], [{input: [1000], output: [1000]}]);
[{ input: [0], output: [0.5, 0.5], }]);
check([], [100, 1001], [0, 10000], [{ input: [1000], output: [1000], }]);
});
it('check output boundaries', function () {
check([], [0, 1], [0, 0.5], [{input: [1], output: [0.5]}]);
check([], [0, 1], [0.5, 1], [{input: [0], output: [0.5]}]);
check([], [0, 1], [0, 0.5], [{ input: [1], output: [0.5], }]);
check([], [0, 1], [0.5, 1], [{ input: [0], output: [0.5], }]);
check(['dup'], [0, 1], [0.5, 1, 0.75, 1],
[{input: [0], output: [0.5, 0.75]}]);
check([], [0, 10000], [100, 1001], [{input: [1000], output: [1000]}]);
[{ input: [0], output: [0.5, 0.75], }]);
check([], [0, 10000], [100, 1001], [{ input: [1000], output: [1000], }]);
});
it('compile optimized', function () {
var compiler = new PostScriptCompiler();