Grammalecte  Diff

Differences From Artifact [2455a96fb4]:

To Artifact [147f1c4e7b]:


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
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









-
-
-
-
+
+
+
+














-
+







// JavaScript

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

"use strict";


if(typeof process !== 'undefined') {
    var helpers = require('./graphspell/helpers.js');
} else 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') {
        if(typeof(process) !== 'undefined') {
            sURL = (this.spfTests !== "") ? this.spfTests : "./"+this.gce.lang+"/tests_data.json";
        } else {
            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;
158
159
160
161
162
163
164
165

166
167
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;
}