Update tests to fix failures from formatter definition changes

This commit is contained in:
Mohsin Kaleem 2023-03-12 10:45:14 +00:00
parent ceaddebf39
commit e2062d612d
9 changed files with 53 additions and 76 deletions

View file

@ -226,8 +226,12 @@ environment variable, defaulting to all formatters."
(let ((load-suffixes '(".el")))
(locate-library "apheleia"))))))
exec-path)))
;; Some formatters use the current file-name or buffer-name to interpret the
;; type of file that is being formatted. Some may not be able to determine
;; this from the contents of the file so we set this to force it.
(rename-buffer in-file)
(setq stdout-buffer (get-buffer-create
(format "*apheleia-ft-stdout-%S" formatter)))
(format "*apheleia-ft-stdout-%S%s" formatter extension)))
(with-current-buffer stdout-buffer
(erase-buffer))
(if (functionp command)
@ -243,41 +247,14 @@ environment variable, defaulting to all formatters."
(copy-to-buffer stdout-buffer (point-min) (point-max))))
(progn
(let ((result (apheleia--format-command command nil nil)))
(setq command (nthcdr 3 result)
in-temp-real-file (nth 0 result)
out-temp-file (nth 1 result)))
(with-current-buffer stdout-buffer
(erase-buffer))
(mapc
(lambda (arg)
(when (memq arg '(file filepath input output inplace))
(cl-pushnew arg syms)))
command)
(when (or (memq 'file syms) (memq 'filepath syms))
(setq in-temp-real-file (apheleia-ft--write-temp-file
in-text extension)))
(when (or (memq 'input syms) (memq 'inplace syms))
(setq in-temp-file (apheleia-ft--write-temp-file
in-text extension))
(when (memq 'inplace syms)
(setq out-temp-file in-temp-file)))
(when (memq 'output syms)
(setq out-temp-file (apheleia-ft--write-temp-file
"" extension)))
(setq command (delq 'npx command))
(setq command
(mapcar
(lambda (arg)
(pcase arg
((or `file `filepath)
in-temp-real-file)
((or `input `inplace)
in-temp-file)
(`output
out-temp-file)
((guard (stringp arg))
arg)
(_ (eval arg))))
command))
(setq stdout-buffer (get-buffer-create
(format "*apheleia-ft-stdout-%S" formatter)))
(setq exit-status
(apply
#'call-process

View file

@ -1,6 +1,6 @@
body {
padding-left: 11em;
font-family: Georgia, "Times New Roman", Times, serif;
color: purple;
background-color: #d8da3d;
padding-left: 11em;
font-family: Georgia, "Times New Roman", Times, serif;
color: purple;
background-color: #d8da3d;
}

View file

@ -1,6 +1,6 @@
{
human(id: "1000") {
name
height(unit: FOOT)
}
human(id: "1000") {
name
height(unit: FOOT)
}
}

View file

@ -1,5 +1,5 @@
<h2>
Minify <abbr title="HyperText Markup Language">HTML</abbr> and any
<abbr title="Cascading Style Sheets">CSS</abbr> or
<abbr title="JavaScript">JS</abbr> included in your markup
Minify <abbr title="HyperText Markup Language">HTML</abbr> and any
<abbr title="Cascading Style Sheets">CSS</abbr> or
<abbr title="JavaScript">JS</abbr> included in your markup
</h2>

View file

@ -1,10 +1,10 @@
function HelloWorld({
greeting = "hello",
greeted = '"World"',
silent = false,
onMouseOver,
greeting = "hello",
greeted = '"World"',
silent = false,
onMouseOver,
}) {
if (!greeting) {
return null;
}
if (!greeting) {
return null;
}
}

View file

@ -1,19 +1,19 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}

View file

@ -3,7 +3,7 @@ $bgcolor: lightblue;
$textcolor: darkblue;
$fontsize: 18px; /* Use the variables */
body {
background-color: $bgcolor;
color: $textcolor;
font-size: $fontsize;
background-color: $bgcolor;
color: $textcolor;
font-size: $fontsize;
}

View file

@ -1,6 +1,6 @@
interface GreetingSettings {
greeting: string;
duration?: number;
color?: string;
greeting: string;
duration?: number;
color?: string;
}
declare function greet(setting: GreetingSettings): void;

View file

@ -1,3 +1,3 @@
function f() {
thing
thing
}