fix(tui): highlight shell script files (#44772)
This commit is contained in:
@@ -89,10 +89,10 @@ export const LANGUAGE_EXTENSIONS: Record<string, string> = {
|
||||
".sass": "sass",
|
||||
".scala": "scala",
|
||||
".shader": "shaderlab",
|
||||
".sh": "shellscript",
|
||||
".bash": "shellscript",
|
||||
".zsh": "shellscript",
|
||||
".ksh": "shellscript",
|
||||
".sh": "bash",
|
||||
".bash": "bash",
|
||||
".zsh": "bash",
|
||||
".ksh": "bash",
|
||||
".sql": "sql",
|
||||
".svelte": "svelte",
|
||||
".swift": "swift",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import parsers from "../../src/parsers-config"
|
||||
import { filetype } from "../../src/util/filetype"
|
||||
|
||||
describe("util.filetype", () => {
|
||||
@@ -9,6 +10,12 @@ describe("util.filetype", () => {
|
||||
expect(filetype("README.unknown")).toBeUndefined()
|
||||
})
|
||||
|
||||
test("maps shell filenames to the registered bash parser", () => {
|
||||
const languages = ["script.sh", "script.bash", "script.zsh", "script.ksh"].map(filetype)
|
||||
expect(languages).toEqual(["bash", "bash", "bash", "bash"])
|
||||
expect(parsers.parsers.some((parser) => languages.every((language) => language === parser.filetype))).toBe(true)
|
||||
})
|
||||
|
||||
test("uses none for missing filenames", () => {
|
||||
expect(filetype()).toBe("none")
|
||||
expect(filetype("")).toBe("none")
|
||||
|
||||
Reference in New Issue
Block a user