Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/unit/pandoc-codegen/native-string.test.ts
6451 views
1
/*
2
* native-string.test.ts
3
*
4
* Copyright (C) 2021-2022 Posit Software, PBC
5
*
6
*/
7
8
import { unitTest } from "../../test.ts";
9
import { assertEquals } from "testing/asserts";
10
import { pandocNativeStr } from "../../../src/core/pandoc/codegen.ts";
11
12
// deno-lint-ignore require-await
13
unitTest("native-string - basics", async () => {
14
assertEquals(pandocNativeStr("hello").mappedString().value, '`Str "hello"`{=pandoc-native}');
15
assertEquals(pandocNativeStr('"hello"').mappedString().value, '`Str "\\"hello\\""`{=pandoc-native}');
16
assertEquals(pandocNativeStr('"hel`lo"').mappedString().value, '``Str "\\"hel`lo\\""``{=pandoc-native}');
17
assertEquals(pandocNativeStr('"hello\nworld"').mappedString().value, '`Str "\\"hello\\nworld\\""`{=pandoc-native}');
18
assertEquals(pandocNativeStr('"hello\\\'world"').mappedString().value, '`Str "\\"hello\\\'world\\""`{=pandoc-native}');
19
})
20
21