@ohos-ports/llparse-test-fixture 0.0.0-stage → 5.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/lib/fixture.d.ts +23 -0
- package/lib/fixture.js +181 -0
- package/lib/fixture.js.map +1 -0
- package/lib/result.d.ts +15 -0
- package/lib/result.js +183 -0
- package/lib/result.js.map +1 -0
- package/package.json +45 -4
- package/src/fixture.ts +224 -0
- package/src/native/fixture.c +460 -0
- package/src/native/fixture.h +13 -0
- package/src/result.ts +239 -0
- package/src/wasm-runner.js +49 -0
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# llparse-test-fixture
|
|
2
|
+
[](https://badge.fury.io/js/llparse-test-fixture)
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
A test fixture for llparse (and llparse-based modules).
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
TBD
|
|
9
|
+
|
|
10
|
+
#### LICENSE
|
|
11
|
+
|
|
12
|
+
This software is licensed under the MIT License.
|
|
13
|
+
|
|
14
|
+
Copyright Fedor Indutny, 2018.
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
17
|
+
copy of this software and associated documentation files (the
|
|
18
|
+
"Software"), to deal in the Software without restriction, including
|
|
19
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
20
|
+
distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
21
|
+
persons to whom the Software is furnished to do so, subject to the
|
|
22
|
+
following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included
|
|
25
|
+
in all copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
28
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
29
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
30
|
+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
31
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
32
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
33
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/lib/fixture.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FixtureResult, IFixtureResultOptions } from './result';
|
|
2
|
+
export { FixtureResult, IFixtureResultOptions };
|
|
3
|
+
export interface IFixtureOptions {
|
|
4
|
+
readonly buildDir: string;
|
|
5
|
+
readonly clang?: string;
|
|
6
|
+
readonly wasm?: string;
|
|
7
|
+
readonly extra?: ReadonlyArray<string>;
|
|
8
|
+
readonly maxParallel?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface IFixtureBuildOptions {
|
|
11
|
+
readonly extra?: ReadonlyArray<string>;
|
|
12
|
+
}
|
|
13
|
+
export interface IFixtureArtifacts {
|
|
14
|
+
readonly header: string;
|
|
15
|
+
readonly c: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const ERROR_PAUSE = 2141666474;
|
|
18
|
+
export declare class Fixture {
|
|
19
|
+
private readonly options;
|
|
20
|
+
constructor(options: IFixtureOptions);
|
|
21
|
+
build(artifacts: IFixtureArtifacts, name: string, options?: IFixtureBuildOptions): Promise<FixtureResult>;
|
|
22
|
+
private clang;
|
|
23
|
+
}
|
package/lib/fixture.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fixture = exports.ERROR_PAUSE = exports.FixtureResult = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const crypto = require("node:crypto");
|
|
6
|
+
const fs = require("node:fs");
|
|
7
|
+
const os = require("node:os");
|
|
8
|
+
const path = require("node:path");
|
|
9
|
+
const result_1 = require("./result");
|
|
10
|
+
Object.defineProperty(exports, "FixtureResult", { enumerable: true, get: function () { return result_1.FixtureResult; } });
|
|
11
|
+
const CLANG = process.env.CLANG || 'clang';
|
|
12
|
+
const CFLAGS = process.env.CFLAGS || '';
|
|
13
|
+
const WASM = process.env.WASM;
|
|
14
|
+
const WASM_CFLAGS = process.env.WASM_CFLAGS || '';
|
|
15
|
+
const NATIVE_DIR = path.join(__dirname, '..', 'src', 'native');
|
|
16
|
+
const FIXTURE = path.join(NATIVE_DIR, 'fixture.c');
|
|
17
|
+
// Just a random value, really
|
|
18
|
+
exports.ERROR_PAUSE = 0x7fa73caa;
|
|
19
|
+
class Fixture {
|
|
20
|
+
options;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.options = {
|
|
23
|
+
buildDir: options.buildDir,
|
|
24
|
+
clang: options.clang === undefined ? CLANG : options.clang,
|
|
25
|
+
wasm: options.wasm === undefined ? WASM : options.wasm,
|
|
26
|
+
extra: options.extra || [],
|
|
27
|
+
maxParallel: options.maxParallel === undefined ?
|
|
28
|
+
os.cpus().length :
|
|
29
|
+
options.maxParallel,
|
|
30
|
+
};
|
|
31
|
+
try {
|
|
32
|
+
fs.mkdirSync(this.options.buildDir, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
// no-op
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async build(artifacts, name, options = {}) {
|
|
39
|
+
const BUILD_DIR = this.options.buildDir;
|
|
40
|
+
const hash = crypto.createHash('sha256');
|
|
41
|
+
const c = path.join(BUILD_DIR, name + '.c');
|
|
42
|
+
const header = path.join(BUILD_DIR, name + '.h');
|
|
43
|
+
hash.update('header');
|
|
44
|
+
hash.update(artifacts.header);
|
|
45
|
+
await fs.promises.writeFile(header, artifacts.header);
|
|
46
|
+
const commonArgs = [
|
|
47
|
+
'-g3', '-Os', '-fvisibility=hidden',
|
|
48
|
+
'-I', NATIVE_DIR,
|
|
49
|
+
'-I', BUILD_DIR,
|
|
50
|
+
'-include', header,
|
|
51
|
+
FIXTURE,
|
|
52
|
+
];
|
|
53
|
+
const args = {
|
|
54
|
+
c: ['-msse4.2'],
|
|
55
|
+
wasm: [
|
|
56
|
+
'-msimd128',
|
|
57
|
+
'-fno-exceptions',
|
|
58
|
+
'-mexec-model=reactor',
|
|
59
|
+
'-Wl,-error-limit=0',
|
|
60
|
+
'-Wl,--allow-undefined',
|
|
61
|
+
'-Wl,--export-dynamic',
|
|
62
|
+
'-Wl,--export-table',
|
|
63
|
+
'-Wl,--export=malloc',
|
|
64
|
+
'-Wl,--export=free',
|
|
65
|
+
'-Wl,--no-entry',
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
// This is rather lame, but should work
|
|
69
|
+
if (CFLAGS) {
|
|
70
|
+
for (const flag of CFLAGS.split(/\s+/g)) {
|
|
71
|
+
args.c.push(flag);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (WASM_CFLAGS) {
|
|
75
|
+
for (const flag of WASM_CFLAGS.split(/\s+/g)) {
|
|
76
|
+
args.wasm.push(flag);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
hash.update('c');
|
|
80
|
+
hash.update(artifacts.c);
|
|
81
|
+
await fs.promises.writeFile(c, artifacts.c);
|
|
82
|
+
args.c.push(c);
|
|
83
|
+
args.wasm.push(c);
|
|
84
|
+
for (const extra of this.options.extra) {
|
|
85
|
+
commonArgs.push(extra);
|
|
86
|
+
}
|
|
87
|
+
if (options.extra) {
|
|
88
|
+
for (const extra of options.extra) {
|
|
89
|
+
commonArgs.push(extra);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
hash.update('common-args');
|
|
93
|
+
hash.update(commonArgs.join(' '));
|
|
94
|
+
const digest = hash.digest('hex');
|
|
95
|
+
const executables = [];
|
|
96
|
+
{
|
|
97
|
+
const out = path.join(BUILD_DIR, name + '-c.' + digest);
|
|
98
|
+
const link = path.join(BUILD_DIR, name + '-c');
|
|
99
|
+
if (!fs.existsSync(out)) {
|
|
100
|
+
await this.clang(this.options.clang, commonArgs.concat(args.c, '-o', out));
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
await fs.promises.unlink(link);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
// no-op
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
await fs.promises.link(out, link);
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
// Some file systems (e.g. hmdfs on HarmonyOS) do not support
|
|
113
|
+
// hard links and return EPERM. Fall back to copying the file.
|
|
114
|
+
// copyFile preserves the source file's mode (executable bit).
|
|
115
|
+
await fs.promises.copyFile(out, link);
|
|
116
|
+
try {
|
|
117
|
+
fs.accessSync(link, fs.constants.X_OK);
|
|
118
|
+
}
|
|
119
|
+
catch (e2) {
|
|
120
|
+
await fs.promises.chmod(link, 0o755);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
executables.push(out);
|
|
124
|
+
}
|
|
125
|
+
if (this.options.wasm) {
|
|
126
|
+
const out = path.join(BUILD_DIR, name + '-' + digest + '.wasm');
|
|
127
|
+
const link = path.join(BUILD_DIR, name + '.wasm');
|
|
128
|
+
if (!fs.existsSync(out)) {
|
|
129
|
+
await this.clang(this.options.wasm, commonArgs.concat(args.wasm, '-o', out));
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
await fs.promises.unlink(link);
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
// no-op
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
await fs.promises.link(out, link);
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
// Some file systems (e.g. hmdfs on HarmonyOS) do not support
|
|
142
|
+
// hard links and return EPERM. Fall back to copying the file.
|
|
143
|
+
// copyFile preserves the source file's mode (executable bit).
|
|
144
|
+
await fs.promises.copyFile(out, link);
|
|
145
|
+
try {
|
|
146
|
+
fs.accessSync(link, fs.constants.X_OK);
|
|
147
|
+
}
|
|
148
|
+
catch (e2) {
|
|
149
|
+
await fs.promises.chmod(link, 0o755);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
executables.push(out);
|
|
153
|
+
}
|
|
154
|
+
return new result_1.FixtureResult(executables, this.options.maxParallel);
|
|
155
|
+
}
|
|
156
|
+
async clang(bin, args) {
|
|
157
|
+
const proc = (0, node_child_process_1.spawn)(bin, args, {
|
|
158
|
+
stdio: [null, 'pipe', 'pipe'],
|
|
159
|
+
});
|
|
160
|
+
const stdout = [];
|
|
161
|
+
proc.stdout.on('data', (chunk) => stdout.push(chunk));
|
|
162
|
+
const stderr = [];
|
|
163
|
+
proc.stderr.on('data', (chunk) => stderr.push(chunk));
|
|
164
|
+
const code = await new Promise((resolve) => {
|
|
165
|
+
proc.once('exit', exitCode => resolve(exitCode));
|
|
166
|
+
});
|
|
167
|
+
if (code !== 0) {
|
|
168
|
+
if (stdout.length > 0) {
|
|
169
|
+
process.stderr.write(Buffer.concat(stdout).toString());
|
|
170
|
+
}
|
|
171
|
+
if (stderr.length > 0) {
|
|
172
|
+
process.stderr.write(Buffer.concat(stderr).toString());
|
|
173
|
+
}
|
|
174
|
+
const escapedArgs = args.map(arg => JSON.stringify(arg));
|
|
175
|
+
throw new Error('clang exit code: ' + code +
|
|
176
|
+
`\narguments: ${escapedArgs.join(' ')}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
exports.Fixture = Fixture;
|
|
181
|
+
//# sourceMappingURL=fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../src/fixture.ts"],"names":[],"mappings":";;;AAAA,2DAA2C;AAC3C,sCAAsC;AACtC,8BAA8B;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AM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACzD,CAAC;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,IAAI;gBACxC,gBAAgB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF;AAzJD,0BAyJC"}
|
package/lib/result.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type FixtureExpected = string | RegExp | ReadonlyArray<string | RegExp>;
|
|
2
|
+
export interface IFixtureResultOptions {
|
|
3
|
+
readonly noScan?: boolean;
|
|
4
|
+
readonly scan?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class FixtureResult {
|
|
7
|
+
private readonly executables;
|
|
8
|
+
private readonly maxParallel;
|
|
9
|
+
constructor(executables: ReadonlyArray<string>, maxParallel: number);
|
|
10
|
+
check(input: string, expected: FixtureExpected, options?: IFixtureResultOptions): Promise<void>;
|
|
11
|
+
private spawn;
|
|
12
|
+
private spawnSingle;
|
|
13
|
+
private checkScan;
|
|
14
|
+
private normalizeSpans;
|
|
15
|
+
}
|
package/lib/result.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FixtureResult = void 0;
|
|
4
|
+
const assert = require("node:assert");
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const path = require("node:path");
|
|
7
|
+
const WASM_RUNNER = path.join(__dirname, '..', 'src', 'wasm-runner.js');
|
|
8
|
+
class FixtureResult {
|
|
9
|
+
executables;
|
|
10
|
+
maxParallel;
|
|
11
|
+
constructor(executables, maxParallel) {
|
|
12
|
+
this.executables = executables;
|
|
13
|
+
this.maxParallel = maxParallel;
|
|
14
|
+
}
|
|
15
|
+
async check(input, expected, options = {}) {
|
|
16
|
+
const ranges = [];
|
|
17
|
+
const maxParallel = this.maxParallel;
|
|
18
|
+
const rawLength = Buffer.byteLength(input);
|
|
19
|
+
const len = Math.ceil(rawLength / maxParallel);
|
|
20
|
+
if (options.noScan === true) {
|
|
21
|
+
ranges.push({ from: rawLength, to: rawLength + 1 });
|
|
22
|
+
}
|
|
23
|
+
else if (options.scan) {
|
|
24
|
+
ranges.push({ from: options.scan, to: options.scan + 1 });
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
for (let i = 1; i <= rawLength; i += len) {
|
|
28
|
+
ranges.push({
|
|
29
|
+
from: i,
|
|
30
|
+
to: Math.min(i + len, rawLength + 1),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
await Promise.all(ranges.map(async (range) => {
|
|
35
|
+
for (const single of await this.spawn(range, input)) {
|
|
36
|
+
for (const [index, output] of single.outputs.entries()) {
|
|
37
|
+
this.checkScan(single.name, index + 1, output, expected);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
async spawn(range, input) {
|
|
43
|
+
return await Promise.all(this.executables.map((executable) => {
|
|
44
|
+
return this.spawnSingle(executable, range, input);
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
async spawnSingle(executable, range, input) {
|
|
48
|
+
const name = path.basename(executable);
|
|
49
|
+
let bin = executable;
|
|
50
|
+
const args = [
|
|
51
|
+
`${range.from}:${range.to}`,
|
|
52
|
+
input,
|
|
53
|
+
];
|
|
54
|
+
if (executable.endsWith('.wasm')) {
|
|
55
|
+
bin = process.execPath;
|
|
56
|
+
args.unshift(executable);
|
|
57
|
+
args.unshift(WASM_RUNNER);
|
|
58
|
+
}
|
|
59
|
+
const proc = (0, node_child_process_1.spawn)(bin, args, {
|
|
60
|
+
shell: process.platform === 'win32',
|
|
61
|
+
stdio: [null, 'pipe', 'pipe'],
|
|
62
|
+
});
|
|
63
|
+
const stdout = [];
|
|
64
|
+
proc.stdout.on('data', (chunk) => stdout.push(chunk));
|
|
65
|
+
const stderr = [];
|
|
66
|
+
proc.stderr.on('data', (chunk) => stderr.push(chunk));
|
|
67
|
+
const onEnd = new Promise(resolve => proc.stdout.once('end', () => resolve()));
|
|
68
|
+
const { code, signal } = await new Promise((resolve) => {
|
|
69
|
+
proc.once('exit', (exitCode, exitSignal) => {
|
|
70
|
+
resolve({ code: exitCode, signal: exitSignal });
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
await onEnd;
|
|
74
|
+
const stdoutText = Buffer.concat(stdout).toString();
|
|
75
|
+
const stderrText = Buffer.concat(stderr).toString();
|
|
76
|
+
const stdOutErr = `stdout: ${stdoutText}\nstderr: ${stderrText}`;
|
|
77
|
+
if (signal) {
|
|
78
|
+
throw new Error(`Test "${name}" killed with signal: "${signal}".\n${stdOutErr}`);
|
|
79
|
+
}
|
|
80
|
+
if (code !== 0) {
|
|
81
|
+
throw new Error(`Test "${name}" exited with code: "${code}".\n${stdOutErr}`);
|
|
82
|
+
}
|
|
83
|
+
const out = stdoutText.split(/===== SCAN \d+ START =====\n/g).slice(1);
|
|
84
|
+
return {
|
|
85
|
+
name,
|
|
86
|
+
outputs: out.map(part => this.normalizeSpans(part)),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
checkScan(name, scan, actual, expected) {
|
|
90
|
+
if (typeof expected === 'string') {
|
|
91
|
+
assert.strictEqual(actual, expected, `Executable: ${name}\n` +
|
|
92
|
+
`Scan value: ${scan}`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (expected instanceof RegExp) {
|
|
96
|
+
expected.lastIndex = 0;
|
|
97
|
+
assert.ok(expected.test(actual), `Executable: ${name}\n` +
|
|
98
|
+
`Scan value: ${scan}\n` +
|
|
99
|
+
` got : ${JSON.stringify(actual)}\n` +
|
|
100
|
+
` against : ${expected}`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
assert(Array.isArray(expected) &&
|
|
104
|
+
expected.every((line) => {
|
|
105
|
+
return typeof line === 'string' || line instanceof RegExp;
|
|
106
|
+
}), '`expected` must be a string, RegExp, or Array[String|RegExp]');
|
|
107
|
+
const lines = actual.split('\n');
|
|
108
|
+
while (lines.length && lines[lines.length - 1]) {
|
|
109
|
+
lines.pop();
|
|
110
|
+
}
|
|
111
|
+
// If they differ - we are going to fail
|
|
112
|
+
while (lines.length < expected.length) {
|
|
113
|
+
lines.push('');
|
|
114
|
+
}
|
|
115
|
+
// Just make it fail, there shouldn't be extra lines
|
|
116
|
+
const expectedArr = expected.slice();
|
|
117
|
+
while (expectedArr.length < lines.length) {
|
|
118
|
+
expectedArr.push(/$^/);
|
|
119
|
+
}
|
|
120
|
+
lines.forEach((line, lineNum) => {
|
|
121
|
+
const expectedLine = expectedArr[lineNum];
|
|
122
|
+
if (typeof expectedLine === 'string') {
|
|
123
|
+
assert.strictEqual(line, expectedLine, `Executable: ${name}\n` +
|
|
124
|
+
`Scan value: ${scan} at line: ${lineNum + 1}\n` +
|
|
125
|
+
` output : ${lines.join('\n')}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
expectedLine.lastIndex = 0;
|
|
129
|
+
assert.ok(expectedLine.test(line), `Executable: ${name}\n` +
|
|
130
|
+
`Scan value: ${scan} at line: ${lineNum + 1}\n` +
|
|
131
|
+
` got : ${JSON.stringify(line)}\n` +
|
|
132
|
+
` against : ${expectedLine}\n` +
|
|
133
|
+
` output : ${lines.join('\n')}`);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
normalizeSpans(source) {
|
|
137
|
+
const lines = source.split(/\n/g);
|
|
138
|
+
const parse = (line) => {
|
|
139
|
+
const match = line.match(/^off=(\d+)\s+len=(\d+)\s+span\[([^\]]+)\]="(.*)"$/);
|
|
140
|
+
if (!match) {
|
|
141
|
+
return { type: 'raw', value: line };
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
len: parseInt(match[2], 10),
|
|
145
|
+
off: parseInt(match[1], 10),
|
|
146
|
+
span: match[3],
|
|
147
|
+
type: 'span',
|
|
148
|
+
value: match[4],
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
const parsed = lines.filter(l => l).map(parse);
|
|
152
|
+
const lastMap = new Map();
|
|
153
|
+
const res = [];
|
|
154
|
+
parsed.forEach((obj) => {
|
|
155
|
+
if (obj.type === 'raw') {
|
|
156
|
+
res.push(obj);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (lastMap.has(obj.span)) {
|
|
160
|
+
const last = lastMap.get(obj.span);
|
|
161
|
+
if (last.off + last.len === obj.off) {
|
|
162
|
+
last.len += obj.len;
|
|
163
|
+
last.value += obj.value;
|
|
164
|
+
// Move it to the end
|
|
165
|
+
res.splice(res.indexOf(last), 1);
|
|
166
|
+
res.push(last);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
res.push(obj);
|
|
171
|
+
lastMap.set(obj.span, obj);
|
|
172
|
+
});
|
|
173
|
+
const stringify = (obj) => {
|
|
174
|
+
if (obj.type === 'raw') {
|
|
175
|
+
return obj.value;
|
|
176
|
+
}
|
|
177
|
+
return `off=${obj.off} len=${obj.len} span[${obj.span}]="${obj.value}"`;
|
|
178
|
+
};
|
|
179
|
+
return res.map(stringify).join('\n') + '\n';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.FixtureResult = FixtureResult;
|
|
183
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,2DAA2C;AAC3C,kCAAkC;A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1",
|
|
4
|
+
"description": "A test fixture for llparse (and llparse-based modules)",
|
|
5
|
+
"main": "lib/fixture.js",
|
|
6
|
+
"types": "lib/fixture.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"clean": "rm -rf lib",
|
|
10
|
+
"lint": "eslint -c eslint.json src/**/*.ts test/**/*.ts",
|
|
11
|
+
"lint:fix": "eslint --fix -c eslint.json src/**/*.ts test/**/*.ts",
|
|
12
|
+
"test": "node -r ts-node/register/type-check ./test/fixture.test.ts"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"lib",
|
|
17
|
+
"src"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+ssh://git@github.com/indutny/llparse-test-fixture.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"llparse",
|
|
25
|
+
"test",
|
|
26
|
+
"fixture"
|
|
27
|
+
],
|
|
28
|
+
"author": "Fedor Indutny <fedor@indutny.com> (http://darksi.de/)",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/indutny/llparse-test-fixture/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/indutny/llparse-test-fixture#readme",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@stylistic/eslint-plugin": "^1.5.4",
|
|
36
|
+
"@types/node": "^20.11.16",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
38
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
39
|
+
"eslint": "^8.56.0",
|
|
40
|
+
"ts-node": "^10.9.2",
|
|
41
|
+
"typescript": "^5.3.3"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"llparse": "^7.0.0",
|
|
45
|
+
"yargs": "^15.4.1"
|
|
46
|
+
}
|
|
47
|
+
}
|