Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for incorrect highlighting in verbatim strings
- Loading branch information
1 parent
96f6c3a
commit 45bb5c2
Showing
21 changed files
with
222 additions
and
93 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// evaluates to '\'abc\'' | ||
var multilineExtraQuotes = ''''abc'''' | ||
// evaluates to '\'\nabc\n\'' | ||
var multilineExtraQuotesNewlines = '''' | ||
abc | ||
'''' | ||
var multilineSingleLine = '''hello!''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
<!-- | ||
Preview this file by prepending http://htmlpreview.github.io/? to its URL | ||
e.g. http://htmlpreview.github.io/?https://raw.githubusercontent.com/Azure/bicep/main/src/highlightjs/test/baselines/strings.html | ||
--> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/default.min.css"> | ||
</head> | ||
<body> | ||
<pre class="hljs"> | ||
<span class="hljs-comment">// evaluates to '\'abc\''</span> | ||
<span class="hljs-variable"><span class="hljs-keyword">var</span></span> <span class="hljs-variable">multilineExtraQuotes</span> = <span class="hljs-string">''''abc''''</span> | ||
|
||
<span class="hljs-comment">// evaluates to '\'\nabc\n\''</span> | ||
<span class="hljs-variable"><span class="hljs-keyword">var</span></span> <span class="hljs-variable">multilineExtraQuotesNewlines</span> = <span class="hljs-string">'''' | ||
abc | ||
''''</span> | ||
|
||
<span class="hljs-variable"><span class="hljs-keyword">var</span></span> <span class="hljs-variable">multilineSingleLine</span> = <span class="hljs-string">'''hello!'''</span> | ||
|
||
</pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { existsSync } from "fs"; | ||
import { writeFile, mkdir, readFile } from "fs/promises"; | ||
import path from "path"; | ||
|
||
export const baselineRecordEnabled = (process.env['BASELINE_RECORD']?.toLowerCase() === 'true'); | ||
|
||
export async function expectFileContents(filePath: string, contents: string) { | ||
if (baselineRecordEnabled) { | ||
await mkdir(path.dirname(filePath), { recursive: true }); | ||
await writeFile(filePath, contents, 'utf-8'); | ||
} else { | ||
// If these assertions fail, use 'npm run test:fix' to replace the baseline files | ||
expect(existsSync(filePath)).toBeTruthy(); | ||
|
||
const readContents = await readFile(filePath, { encoding: 'utf8' }); | ||
expect(contents).toBe(readContents); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// evaluates to '\'abc\'' | ||
var multilineExtraQuotes = ''''abc'''' | ||
// evaluates to '\'\nabc\n\'' | ||
var multilineExtraQuotesNewlines = '''' | ||
abc | ||
'''' | ||
var multilineSingleLine = '''hello!''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
<!-- | ||
Preview this file by prepending http://htmlpreview.github.io/? to its URL | ||
e.g. http://htmlpreview.github.io/?https://raw.githubusercontent.com/Azure/bicep/main/src/monarch/test/baselines/strings.html | ||
--> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/default.min.css"> | ||
</head> | ||
<body> | ||
<pre class="hljs"> | ||
<span class="hljs-comment">// evaluates to '\'abc\''</span> | ||
<span class="hljs-keyword">var</span> <span class="hljs-variable">multilineExtraQuotes</span> = <span class="hljs-string">'''</span><span class="hljs-string">'abc</span><span class="hljs-string">''''</span> | ||
|
||
<span class="hljs-string">// evaluates to '</span>\<span class="hljs-string">'</span><span class="hljs-string">\n</span><span class="hljs-string">abc</span><span class="hljs-string">\n\'</span><span class="hljs-string">'</span> | ||
<span class="hljs-keyword">var</span> <span class="hljs-variable">multilineExtraQuotesNewlines</span> = <span class="hljs-string">'''</span>' | ||
<span class="hljs-string">abc</span> | ||
<span class="hljs-string">''''</span> | ||
|
||
<span class="hljs-string">var multilineSingleLine = '</span><span class="hljs-string">'</span><span class="hljs-string">'</span><span class="hljs-variable">hello</span>!<span class="hljs-string">'''</span> | ||
|
||
|
||
</pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { existsSync } from "fs"; | ||
import { writeFile, mkdir, readFile } from "fs/promises"; | ||
import path from "path"; | ||
|
||
export const baselineRecordEnabled = (process.env['BASELINE_RECORD']?.toLowerCase() === 'true'); | ||
|
||
export async function expectFileContents(filePath: string, contents: string) { | ||
if (baselineRecordEnabled) { | ||
await mkdir(path.dirname(filePath), { recursive: true }); | ||
await writeFile(filePath, contents, 'utf-8'); | ||
} else { | ||
// If these assertions fail, use 'npm run test:fix' to replace the baseline files | ||
expect(existsSync(filePath)).toBeTruthy(); | ||
|
||
const readContents = await readFile(filePath, { encoding: 'utf8' }); | ||
expect(contents).toBe(readContents); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.