Grammalecte  Diff

Differences From Artifact [1eda44faf6]:

To Artifact [2455a96fb4]:


1


2
3


4
5
6
7
8
9




10
11
12
13
14
15
16
17
18
19
20
21
22




23


24
25
26
27
28
29
30
1
2
3


4
5
6
7
8
9


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39

+
+
-
-
+
+




-
-
+
+
+
+













+
+
+
+
-
+
+







// JavaScript

/* jshint esversion:6, -W097 */
/*jslint esversion: 6*/
/*global console,require,exports*/
/* jslint esversion:6 */
/* global require, exports, console */

"use strict";


if (typeof(require) !== 'undefined') {
    var helpers = require("resource://grammalecte/graphspell/helpers.js");
if(typeof process !== 'undefined') {
    var helpers = require('./graphspell/helpers.js');
} else if (typeof require !== 'undefined') {
    var helpers = require('resource://grammalecte/graphspell/helpers.js');
}


class TestGrammarChecking {

    constructor (gce, spfTests="") {
        this.gce = gce;
        this.spfTests = spfTests;
        this._aRuleTested = new Set();
    }

    * testParse (bDebug=false) {
        const t0 = Date.now();
        let sURL;
        if(typeof process !== 'undefined') {
            sURL = (this.spfTests !== "") ? this.spfTests : "./"+this.gce.lang+"/tests_data.json";
        } else {
        let sURL = (this.spfTests !== "") ? this.spfTests : "resource://grammalecte/"+this.gce.lang+"/tests_data.json";
            sURL = (this.spfTests !== "") ? this.spfTests : "resource://grammalecte/"+this.gce.lang+"/tests_data.json";
        }
        const aData = JSON.parse(helpers.loadFile(sURL)).aData;
        let nInvalid = 0;
        let nTotal = 0;
        let sErrorText;
        let sSugg;
        let sExpectedErrors;
        let sTextToCheck;
149
150
151
152
153
154
155
156

157
158
158
159
160
161
162
163
164

165
166
167







-
+


        }
        return [" ".repeat(sLine.length), ""];
    }

}


if (typeof(exports) !== 'undefined') {
if (typeof exports !== 'undefined') {
    exports.TestGrammarChecking = TestGrammarChecking;
}