Most format tests are passing

This commit is contained in:
Radon Rosborough 2020-07-31 09:27:46 -06:00
parent 30ec0e2ee0
commit 8e63afb8a0
4 changed files with 171 additions and 43 deletions

View File

@ -46,6 +46,13 @@ container first:
Note that building the image typically requires over an hour and 20 GB Note that building the image typically requires over an hour and 20 GB
of disk space. of disk space.
## Maintainer guide
### Updating brittany
Install latest version of Cabal v3, then use it with `--installdir` to
create a binary linked to `/usr/lib/ghc` and slap this on Google
Drive.
## Flag ## Flag
[![Flag](flag.png)](https://www.reddit.com/r/Breath_of_the_Wild/comments/947ewf/flag_of_the_gerudo_based_on_the_flag_of_kazakhstan/) [![Flag](flag.png)](https://www.reddit.com/r/Breath_of_the_Wild/comments/947ewf/flag_of_the_gerudo_based_on_the_flag_of_kazakhstan/)

View File

@ -330,7 +330,17 @@ Nude pagoda careens.
main: "main.c", main: "main.c",
compile: "clang -Wall -Wextra main.c -o main", compile: "clang -Wall -Wextra main.c -o main",
run: "./main", run: "./main",
format: { run: "clang-format main.c" }, format: {
run: "clang-format main.c",
input: `#include <stdio.h>
int main()
{
printf("Hello, world!\\n");
return 0;
}
`,
},
lsp: { lsp: {
setup: `echo '-Wall -Wextra' | sed -E 's/\\s+/\\n/g' > compile_flags.txt`, setup: `echo '-Wall -Wextra' | sed -E 's/\\s+/\\n/g' > compile_flags.txt`,
start: "clangd", start: "clangd",
@ -474,7 +484,17 @@ Refrigerate for 1 hour.
main: "main.cpp", main: "main.cpp",
compile: "clang++ -Wall -Wextra main.cpp -o main", compile: "clang++ -Wall -Wextra main.cpp -o main",
run: "./main", run: "./main",
format: { run: "clang-format main.cpp" }, format: {
run: "clang-format main.cpp",
input: `#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
`,
},
lsp: { lsp: {
setup: `echo '-Wall -Wextra' | sed -E 's/\\s+/\\n/g' > compile_flags.txt`, setup: `echo '-Wall -Wextra' | sed -E 's/\\s+/\\n/g' > compile_flags.txt`,
start: "clangd", start: "clangd",
@ -505,6 +525,14 @@ int main() {
run: "mono main.exe", run: "mono main.exe",
format: { format: {
run: `clang-format --style="{BasedOnStyle: llvm, IndentWidth: 4}" main.cs`, run: `clang-format --style="{BasedOnStyle: llvm, IndentWidth: 4}" main.cs`,
input: `class main
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello, world!");
}
}
`,
}, },
template: `class main { template: `class main {
static void Main(string[] args) { static void Main(string[] args) {
@ -569,7 +597,15 @@ require("/usr/lib/node_modules/coffeescript/repl").start()
main: "main.d", main: "main.d",
compile: "dmd main.d", compile: "dmd main.d",
run: "./main", run: "./main",
format: { run: "dfmt main.d" }, format: {
run: "dfmt main.d",
input: `import std.stdio;
void main() {
writeln("Hello, world!");
}
`,
},
template: `import std.stdio; template: `import std.stdio;
void main() void main()
@ -785,7 +821,17 @@ main() ->
main: "main.go", main: "main.go",
compile: "go build main.go", compile: "go build main.go",
run: "./main", run: "./main",
format: { run: "cat main.go | gofmt" }, format: {
run: "cat main.go | gofmt",
input: `package main
import "fmt"
func main() {
fmt.Println("Hello, world!");
}
`,
},
lsp: { start: "gopls" }, lsp: { start: "gopls" },
template: `package main template: `package main
@ -832,7 +878,15 @@ function main(): void {
repl: "rm -f .ghci && ghci", repl: "rm -f .ghci && ghci",
main: "Main.hs", main: "Main.hs",
run: "(echo ':load Main' && echo 'main') > .ghci && ghci", run: "(echo ':load Main' && echo 'main') > .ghci && ghci",
format: { run: "brittany Main.hs" }, format: {
run: "brittany Main.hs",
input: `module Main where
main :: IO ()
main =
putStrLn "Hello, world!"
`,
},
lsp: { lsp: {
setup: "cp /opt/haskell/hie.yaml hie.yaml", setup: "cp /opt/haskell/hie.yaml hie.yaml",
start: "HIE_HOOGLE_DATABASE=/opt/haskell/hoogle.hoo hie --lsp", start: "HIE_HOOGLE_DATABASE=/opt/haskell/hoogle.hoo hie --lsp",
@ -948,12 +1002,44 @@ PLEASE GIVE UP
run: "java Main", run: "java Main",
format: { format: {
run: `clang-format --style="{BasedOnStyle: llvm, IndentWidth: 4}" Main.java`, run: `clang-format --style="{BasedOnStyle: llvm, IndentWidth: 4}" Main.java`,
input: `public class Main
{
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
`,
}, },
template: `public class Main { template: `public class Main {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Hello, world!"); System.out.println("Hello, world!");
} }
} }
`,
},
javascript: {
aliases: ["node", "js", "web", "jsx", "v8", "closure", "nodejs"],
name: "Node.js",
monacoLang: "javascript",
repl: "node",
main: "main.js",
run: `node -e '
eval.apply(this, [require("fs").readFileSync("main.js", {encoding: "utf-8"})])
require("repl").start()
'`,
format: {
run: "prettier --no-config main.js",
input: `console.log('Hello, world!');
`,
},
pkg: {
install: "yarn add NAME",
uninstall: "yarn remove NAME",
search:
"curl -sS 'https://registry.npmjs.org/-/v1/search?text=NAME' | jq -r '.objects | map(.package.name) | .[]'",
},
template: `console.log("Hello, world!");
`, `,
}, },
julia: { julia: {
@ -1020,7 +1106,13 @@ PLEASE GIVE UP
monacoLang: "less", monacoLang: "less",
main: "main.less", main: "main.less",
run: "lessc main.less", run: "lessc main.less",
format: { run: "prettier --no-config main.less" }, format: {
run: "prettier --no-config main.less",
input: `body:before {
content: "Hello, world!";
}
`,
},
template: `body:before { template: `body:before {
content: "Hello, world!"; content: "Hello, world!";
} }
@ -1109,7 +1201,12 @@ KTHXBYE
main: "main.md", main: "main.md",
compile: "pandoc main.md -o main.html", compile: "pandoc main.md -o main.html",
run: "prettier --no-config main.html", run: "prettier --no-config main.html",
format: { run: "prettier --no-config main.md" }, format: {
run: "prettier --no-config main.md",
input: `Hello, world!
`,
},
template: `Hello, world! template: `Hello, world!
`, `,
}, },
@ -1182,26 +1279,6 @@ message:
compile: "nim compile main.nim", compile: "nim compile main.nim",
run: "./main", run: "./main",
template: `echo "Hello, world!" template: `echo "Hello, world!"
`,
},
nodejs: {
aliases: ["node", "js", "javascript", "web", "jsx", "v8", "closure"],
name: "Node.js",
monacoLang: "javascript",
repl: "node",
main: "main.js",
run: `node -e '
eval.apply(this, [require("fs").readFileSync("main.js", {encoding: "utf-8"})])
require("repl").start()
'`,
format: { run: "prettier --no-config main.js" },
pkg: {
install: "yarn add NAME",
uninstall: "yarn remove NAME",
search:
"curl -sS 'https://registry.npmjs.org/-/v1/search?text=NAME' | jq -r '.objects | map(.package.name) | .[]'",
},
template: `console.log("Hello, world!")
`, `,
}, },
objectivec: { objectivec: {
@ -1212,7 +1289,18 @@ require("repl").start()
compile: compile:
"gcc $(gnustep-config --objc-flags) main.m $(gnustep-config --base-libs) -o main", "gcc $(gnustep-config --objc-flags) main.m $(gnustep-config --base-libs) -o main",
run: "./main", run: "./main",
format: { run: "clang-format main.m" }, format: {
run: "clang-format main.m",
input: `#import <Foundation/Foundation.h>
int main() {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Hello, world!");
[pool drain];
return 0;
}
`,
},
lsp: { lsp: {
setup: `(gnustep-config --objc-flags && gnustep-config --base-libs) | sed -E 's/\\s+/\\n/g' > compile_flags.txt`, setup: `(gnustep-config --objc-flags && gnustep-config --base-libs) | sed -E 's/\\s+/\\n/g' > compile_flags.txt`,
start: "clangd", start: "clangd",
@ -1233,9 +1321,14 @@ int main() {
repl: "ocaml", repl: "ocaml",
input: "123 * 234 ;;", input: "123 * 234 ;;",
run: "ocaml -init main.ml", run: "ocaml -init main.ml",
format: { run: "ocamlformat main.ml" }, format: {
run: "touch .ocamlformat; ocamlformat main.ml",
input: `print_string "Hello, world!\\n";;
`,
},
lsp: { start: "ocamllsp", lang: "ocaml" }, lsp: { start: "ocamllsp", lang: "ocaml" },
template: `print_string "Hello, world!\\n";; template: `;;
print_string "Hello, world!\\n"
`, `,
}, },
octave: { octave: {
@ -1308,7 +1401,11 @@ end.
repl: "re.pl", repl: "re.pl",
main: "main.pl", main: "main.pl",
run: "re.pl --rcfile ./main.pl", run: "re.pl --rcfile ./main.pl",
format: { run: "cat main.pl | perltidy" }, format: {
run: "cat main.pl | perltidy",
input: `print ("Hello, world!\\n")
`,
},
template: `print("Hello, world!\\n") template: `print("Hello, world!\\n")
`, `,
}, },
@ -1500,12 +1597,16 @@ main = do
main: "main.re", main: "main.re",
compile: "bsc main.re > main.js", compile: "bsc main.re > main.js",
run: "NODE_PATH=/usr/lib/node_modules node main.js", run: "NODE_PATH=/usr/lib/node_modules node main.js",
format: { run: "ocamlformat main.re" }, format: {
run: "refmt main.re",
input: `print_string("Hello, world!\\n")
`,
},
lsp: { lsp: {
setup: `cp -a /opt/reasonml/project-template/* ./`, setup: `cp -a /opt/reasonml/project-template/* ./`,
start: "reason-language-server", start: "reason-language-server",
}, },
template: `print_string("Hello, world!\\n") template: `print_string("Hello, world!\\n");
`, `,
}, },
redis: { redis: {
@ -1593,7 +1694,11 @@ binding_irb.run(IRB.conf)
`, `,
run: "ruby main.rb", run: "ruby main.rb",
ensure: `ruby -e 'raise "version mismatch, expected #{RUBY_VERSION}" unless ENV["PATH"].include? ".gem/ruby/#{RUBY_VERSION}/bin"'`, ensure: `ruby -e 'raise "version mismatch, expected #{RUBY_VERSION}" unless ENV["PATH"].include? ".gem/ruby/#{RUBY_VERSION}/bin"'`,
format: { run: "cat main.rb | rufo -x" }, format: {
run: "cat main.rb | rufo -x",
input: `puts "Hello, world!";
`,
},
pkg: { pkg: {
install: "gem install --user-install NAME", install: "gem install --user-install NAME",
uninstall: "gem uninstall --user-install NAME", uninstall: "gem uninstall --user-install NAME",
@ -1652,7 +1757,13 @@ binding_irb.run(IRB.conf)
monacoLang: "scss", monacoLang: "scss",
main: "main.scss", main: "main.scss",
run: "sass main.scss", run: "sass main.scss",
format: { run: "prettier --no-config main.scss" }, format: {
run: "prettier --no-config main.scss",
input: `body:before {
content: "Hello, world!";
}
`,
},
template: `body:before { template: `body:before {
content: "Hello, world!"; content: "Hello, world!";
} }
@ -1932,7 +2043,11 @@ a
repl: "ts-node", repl: "ts-node",
main: "main.ts", main: "main.ts",
run: `ts-node -i -e "$(< main.ts)"`, run: `ts-node -i -e "$(< main.ts)"`,
format: { run: "prettier --no-config main.ts" }, format: {
run: "prettier --no-config main.ts",
input: `console.log('Hello, world!');
`,
},
template: `console.log("Hello, world!"); template: `console.log("Hello, world!");
`, `,
timeout: 15, timeout: 15,
@ -2035,7 +2150,11 @@ message:
main: "main.yaml", main: "main.yaml",
compile: "cat main.yaml | yj -yj > main.json", compile: "cat main.yaml | yj -yj > main.json",
run: "cat main.json | jq .", run: "cat main.json | jq .",
format: { run: "prettier --no-config main.yaml" }, format: {
run: "prettier --no-config main.yaml",
input: `output: 'Hello, world!'
`,
},
template: `output: "Hello, world!" template: `output: "Hello, world!"
`, `,
}, },

View File

@ -542,9 +542,9 @@ function lint(lang: string) {
} }
// These can be removed when the types are adjusted to make these // These can be removed when the types are adjusted to make these
// situations impossible. // situations impossible.
// if (config.format && !config.format.input) { if (config.format && !config.format.input) {
// throw new Error("formatter is missing test"); throw new Error("formatter is missing test");
// } }
// if (config.lsp && !(config.lsp.code && config.lsp.item)) { // if (config.lsp && !(config.lsp.code && config.lsp.item)) {
// throw new Error("LSP is missing test"); // throw new Error("LSP is missing test");
// } // }
@ -568,9 +568,9 @@ const testTypes: {
scope: { scope: {
pred: ({ scope }) => (scope ? true : false), pred: ({ scope }) => (scope ? true : false),
}, },
// format: { format: {
// pred: ({ format }) => (format ? true : false), pred: ({ format }) => (format ? true : false),
// }, },
// lsp: { pred: ({ lsp }) => (lsp ? true : false) }, // lsp: { pred: ({ lsp }) => (lsp ? true : false) },
}; };

View File

@ -68,6 +68,7 @@ opam install -y ocamlformat
opam pin add -y ocaml-lsp-server https://github.com/ocaml/ocaml-lsp.git opam pin add -y ocaml-lsp-server https://github.com/ocaml/ocaml-lsp.git
ln -s /opt/opam/default/bin/ocamlformat /usr/local/bin/ocamlformat ln -s /opt/opam/default/bin/ocamlformat /usr/local/bin/ocamlformat
ln -s /opt/opam/default/bin/ocamllsp /usr/local/bin/ocamllsp ln -s /opt/opam/default/bin/ocamllsp /usr/local/bin/ocamllsp
ln -s /opt/opam/default/bin/refmt /usr/local/bin/refmt
# Perl # Perl
cpanm -n Devel::REPL cpanm -n Devel::REPL
@ -90,6 +91,7 @@ pip3 install black
# ReasonML # ReasonML
npm install -g bs-platform npm install -g bs-platform
opam install -y reason
# Ruby # Ruby
gem install rufo gem install rufo