From a441bbeebf315f90ecf84c621adb697865f3ac14 Mon Sep 17 00:00:00 2001 From: Mads Hougesen Date: Wed, 20 Mar 2024 19:43:56 +0100 Subject: [PATCH] ci: install beautysh --- .github/workflows/validate.yml | 3 +++ src/formatters/beautysh.rs | 18 ++++-------------- src/languages/shell.rs | 2 +- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ef548a53..9442796c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -170,5 +170,8 @@ jobs: - name: goimports run: go install golang.org/x/tools/cmd/goimports@latest + - name: beautysh + run: pip install beautysh + - name: run tests run: cargo test diff --git a/src/formatters/beautysh.rs b/src/formatters/beautysh.rs index dd5b29d2..6595e58c 100644 --- a/src/formatters/beautysh.rs +++ b/src/formatters/beautysh.rs @@ -21,23 +21,13 @@ mod test_beautysh { #[test_with::executable(beautysh)] #[test] fn it_should_format_sh() { - let input = " - -#!/bin/sh + let input = "#!/bin/shell - add () { - echo \"$1\" + \"$2\" + add() { + echo \"$1\" + \"$2\" } - - - - - - - - "; - let expected_output = "#!/bin/sh + let expected_output = "#!/bin/shell add() { echo \"$1\" + \"$2\" diff --git a/src/languages/shell.rs b/src/languages/shell.rs index bf85501c..f13fc684 100644 --- a/src/languages/shell.rs +++ b/src/languages/shell.rs @@ -143,7 +143,7 @@ add() { formatter: MdsfFormatter::Single(Shell::Beautysh), }; - let snippet = setup_snippet(INPUT, EXTENSION).expect("it to save the file"); + let snippet = setup_snippet(input, EXTENSION).expect("it to save the file"); let snippet_path = snippet.path(); let output = l