Path: blob/main/tests/unit/pandoc-codegen/native-string.test.ts
6451 views
/*1* native-string.test.ts2*3* Copyright (C) 2021-2022 Posit Software, PBC4*5*/67import { unitTest } from "../../test.ts";8import { assertEquals } from "testing/asserts";9import { pandocNativeStr } from "../../../src/core/pandoc/codegen.ts";1011// deno-lint-ignore require-await12unitTest("native-string - basics", async () => {13assertEquals(pandocNativeStr("hello").mappedString().value, '`Str "hello"`{=pandoc-native}');14assertEquals(pandocNativeStr('"hello"').mappedString().value, '`Str "\\"hello\\""`{=pandoc-native}');15assertEquals(pandocNativeStr('"hel`lo"').mappedString().value, '``Str "\\"hel`lo\\""``{=pandoc-native}');16assertEquals(pandocNativeStr('"hello\nworld"').mappedString().value, '`Str "\\"hello\\nworld\\""`{=pandoc-native}');17assertEquals(pandocNativeStr('"hello\\\'world"').mappedString().value, '`Str "\\"hello\\\'world\\""`{=pandoc-native}');18})192021