mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-28 00:37:53 +00:00
- reduce whitespace churn - other review comments Fixes: #10622 Co-authored-by: Marc Durdin <marc@durdin.net>
28 lines
831 B
TypeScript
28 lines
831 B
TypeScript
/*
|
|
* Keyman is copyright (C) SIL Global. MIT License.
|
|
*
|
|
* Created by srl on 2025-04-03
|
|
*
|
|
* Test for LineFinder
|
|
*/
|
|
|
|
import { assert } from 'chai';
|
|
import { readFileSync } from 'node:fs';
|
|
import 'mocha';
|
|
import { LineFinder } from '../src/line-utils.js';
|
|
import { makePathToFixture } from './helpers/index.js';
|
|
|
|
describe(`LineFinder test`, () => {
|
|
const path = 'tran_fail-empty.xml';
|
|
|
|
it(`Should be able to process ${path}`, () => {
|
|
const xmlPath = makePathToFixture('xml', `${path}`);
|
|
const data = readFileSync(xmlPath, 'utf-8');
|
|
assert.ok(data);
|
|
const lf = new LineFinder(data);
|
|
assert.ok(lf);
|
|
assert.deepEqual(lf.findOffset(40), { line: 3, column: 0 });
|
|
assert.deepEqual(lf.findOffset(136), { line: 4, column: 2 });
|
|
assert.deepEqual(lf.findOffset(186), { line: 8, column: 2 });
|
|
});
|
|
});
|