mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 17:11:40 -05:00
Update tests to fix failures from formatter definition changes
This commit is contained in:
parent
ceaddebf39
commit
e2062d612d
9 changed files with 53 additions and 76 deletions
|
@ -226,8 +226,12 @@ environment variable, defaulting to all formatters."
|
||||||
(let ((load-suffixes '(".el")))
|
(let ((load-suffixes '(".el")))
|
||||||
(locate-library "apheleia"))))))
|
(locate-library "apheleia"))))))
|
||||||
exec-path)))
|
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
|
(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
|
(with-current-buffer stdout-buffer
|
||||||
(erase-buffer))
|
(erase-buffer))
|
||||||
(if (functionp command)
|
(if (functionp command)
|
||||||
|
@ -243,41 +247,14 @@ environment variable, defaulting to all formatters."
|
||||||
(copy-to-buffer stdout-buffer (point-min) (point-max))))
|
(copy-to-buffer stdout-buffer (point-min) (point-max))))
|
||||||
(progn
|
(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
|
(with-current-buffer stdout-buffer
|
||||||
(erase-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
|
(setq exit-status
|
||||||
(apply
|
(apply
|
||||||
#'call-process
|
#'call-process
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
body {
|
body {
|
||||||
padding-left: 11em;
|
padding-left: 11em;
|
||||||
font-family: Georgia, "Times New Roman", Times, serif;
|
font-family: Georgia, "Times New Roman", Times, serif;
|
||||||
color: purple;
|
color: purple;
|
||||||
background-color: #d8da3d;
|
background-color: #d8da3d;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
human(id: "1000") {
|
human(id: "1000") {
|
||||||
name
|
name
|
||||||
height(unit: FOOT)
|
height(unit: FOOT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<h2>
|
<h2>
|
||||||
Minify <abbr title="HyperText Markup Language">HTML</abbr> and any
|
Minify <abbr title="HyperText Markup Language">HTML</abbr> and any
|
||||||
<abbr title="Cascading Style Sheets">CSS</abbr> or
|
<abbr title="Cascading Style Sheets">CSS</abbr> or
|
||||||
<abbr title="JavaScript">JS</abbr> included in your markup
|
<abbr title="JavaScript">JS</abbr> included in your markup
|
||||||
</h2>
|
</h2>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
function HelloWorld({
|
function HelloWorld({
|
||||||
greeting = "hello",
|
greeting = "hello",
|
||||||
greeted = '"World"',
|
greeted = '"World"',
|
||||||
silent = false,
|
silent = false,
|
||||||
onMouseOver,
|
onMouseOver,
|
||||||
}) {
|
}) {
|
||||||
if (!greeting) {
|
if (!greeting) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
{
|
{
|
||||||
"arrowParens": "always",
|
"arrowParens": "always",
|
||||||
"bracketSpacing": true,
|
"bracketSpacing": true,
|
||||||
"embeddedLanguageFormatting": "auto",
|
"embeddedLanguageFormatting": "auto",
|
||||||
"htmlWhitespaceSensitivity": "css",
|
"htmlWhitespaceSensitivity": "css",
|
||||||
"insertPragma": false,
|
"insertPragma": false,
|
||||||
"jsxBracketSameLine": false,
|
"jsxBracketSameLine": false,
|
||||||
"jsxSingleQuote": false,
|
"jsxSingleQuote": false,
|
||||||
"printWidth": 80,
|
"printWidth": 80,
|
||||||
"proseWrap": "preserve",
|
"proseWrap": "preserve",
|
||||||
"quoteProps": "as-needed",
|
"quoteProps": "as-needed",
|
||||||
"requirePragma": false,
|
"requirePragma": false,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": false,
|
"singleQuote": false,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"trailingComma": "es5",
|
"trailingComma": "es5",
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"vueIndentScriptAndStyle": false
|
"vueIndentScriptAndStyle": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ $bgcolor: lightblue;
|
||||||
$textcolor: darkblue;
|
$textcolor: darkblue;
|
||||||
$fontsize: 18px; /* Use the variables */
|
$fontsize: 18px; /* Use the variables */
|
||||||
body {
|
body {
|
||||||
background-color: $bgcolor;
|
background-color: $bgcolor;
|
||||||
color: $textcolor;
|
color: $textcolor;
|
||||||
font-size: $fontsize;
|
font-size: $fontsize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
interface GreetingSettings {
|
interface GreetingSettings {
|
||||||
greeting: string;
|
greeting: string;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
color?: string;
|
color?: string;
|
||||||
}
|
}
|
||||||
declare function greet(setting: GreetingSettings): void;
|
declare function greet(setting: GreetingSettings): void;
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function f() {
|
function f() {
|
||||||
thing
|
thing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue