Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/unit/mapped-strings/multiple-source.test.ts
6451 views
1
/*
2
* multiple-source.test.ts
3
*
4
* Copyright (C) 2022 Posit Software, PBC
5
*
6
*/
7
8
import { unitTest } from "../../test.ts";
9
import { assert } from "testing/asserts";
10
import {
11
asMappedString,
12
mappedConcat,
13
} from "../../../src/core/lib/mapped-text.ts";
14
15
// deno-lint-ignore require-await
16
unitTest("multiple-mapped-string-sources", async () => {
17
const ms1 = asMappedString("This is from file 1.\n", "file1");
18
const ms2 = asMappedString("This is from file 2.\n", "file2");
19
const c = mappedConcat([ms1, ms2]);
20
assert(c.map(0)?.originalString.fileName === "file1");
21
assert(c.map(21)?.originalString.fileName === "file2");
22
});
23
24