Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: use super for importing formatters in test #341

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/formatters/alejandra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_alejandra {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(alejandra)]
Expand Down Expand Up @@ -79,7 +78,7 @@ buildPythonPackage rec {
let snippet =
setup_snippet(input, language_to_ext("nix")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/autopep8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_autopep8 {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(autopep8)]
Expand All @@ -24,7 +23,7 @@ mod test_autopep8 {
let snippet =
setup_snippet(input, language_to_ext("python")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
9 changes: 3 additions & 6 deletions src/formatters/beautysh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ pub fn run(file_path: &std::path::Path) -> Result<(bool, Option<String>), MdsfEr

#[cfg(test)]
mod test_beautysh {
use crate::{
formatters::{beautysh::run, setup_snippet},
generated::language_to_ext,
};
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(beautysh)]
fn it_should_format_sh() {
Expand All @@ -35,7 +32,7 @@ add() {
let snippet =
setup_snippet(input, language_to_ext("shell")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -61,7 +58,7 @@ add() {
let snippet =
setup_snippet(input, language_to_ext("bash")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
11 changes: 4 additions & 7 deletions src/formatters/biome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ pub fn run_check(snippet_path: &std::path::Path) -> Result<(bool, Option<String>

#[cfg(test)]
mod test_biome {
use crate::{
formatters::{biome::run_format, setup_snippet},
generated::language_to_ext,
};
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(npx)]
fn it_should_format_json() {
Expand All @@ -60,7 +57,7 @@ mod test_biome {
let snippet =
setup_snippet(input, language_to_ext("json")).expect("it to create a snippet file");

let output = run_format(snippet.path())
let output = super::run_format(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -87,7 +84,7 @@ mod test_biome {
let snippet = setup_snippet(input, language_to_ext("javascript"))
.expect("it to create a snippet file");

let output = run_format(snippet.path())
let output = super::run_format(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down Expand Up @@ -117,7 +114,7 @@ number>
let snippet = setup_snippet(input, language_to_ext("typescript"))
.expect("it to create a snippet file");

let output = run_format(snippet.path())
let output = super::run_format(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/black.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_black {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(black)]
Expand All @@ -24,7 +23,7 @@ mod test_black {
let snippet =
setup_snippet(input, language_to_ext("python")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/blue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_blue {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(blue)]
Expand All @@ -24,7 +23,7 @@ mod test_blue {
let snippet =
setup_snippet(input, language_to_ext("python")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_buf {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(buf)]
Expand All @@ -29,7 +28,7 @@ mod test_buf {
let snippet =
setup_snippet(input, language_to_ext("protobuf")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/cabal_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_cabal_format {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(cabal)]
Expand Down Expand Up @@ -53,7 +52,7 @@ executable msdf
let snippet =
setup_snippet(input, language_to_ext("cabal")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
21 changes: 9 additions & 12 deletions src/formatters/clang_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_clang_format {
use crate::{
formatters::{clang_format::run, setup_snippet},
generated::language_to_ext,
};
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(clang-format)]
fn it_should_format_c() {
Expand All @@ -32,7 +29,7 @@ mod test_clang_format {
let snippet =
setup_snippet(input, language_to_ext("c")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -55,7 +52,7 @@ mod test_clang_format {
let snippet =
setup_snippet(input, language_to_ext("cpp")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -80,7 +77,7 @@ mod test_clang_format {
let snippet =
setup_snippet(input, language_to_ext("csharp")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -100,7 +97,7 @@ mod test_clang_format {
let snippet = setup_snippet(input, language_to_ext("javascript"))
.expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down Expand Up @@ -128,7 +125,7 @@ mod test_clang_format {
let snippet =
setup_snippet(input, language_to_ext("json")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -151,7 +148,7 @@ mod test_clang_format {
let snippet = setup_snippet(input, language_to_ext("objective-c"))
.expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -171,7 +168,7 @@ mod test_clang_format {
let snippet =
setup_snippet(input, language_to_ext("protobuf")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -198,7 +195,7 @@ mod test_clang_format {
let snippet =
setup_snippet(input, language_to_ext("java")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/cljstyle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_cljstyle {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(cljstyle)]
Expand Down Expand Up @@ -56,7 +55,7 @@ mod test_cljstyle {
let snippet =
setup_snippet(input, language_to_ext("clojure")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/crystal_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_crystal_format {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(crystal)]
Expand All @@ -27,7 +26,7 @@ end
let snippet =
setup_snippet(input, language_to_ext("crystal")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/csharpier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_csharpier {
use super::run;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(dotnet)]
Expand Down Expand Up @@ -42,7 +41,7 @@ mod test_csharpier {
let snippet =
setup_snippet(input, language_to_ext("csharp")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
7 changes: 3 additions & 4 deletions src/formatters/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub fn run_lint(snippet_path: &std::path::Path) -> Result<(bool, Option<String>)

#[cfg(test)]
mod test_deno_fmt {
use super::run_fmt;
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(deno)]
Expand Down Expand Up @@ -53,7 +52,7 @@ mod test_deno_fmt {
let snippet =
setup_snippet(input, language_to_ext("json")).expect("it to create a snippet file");

let output = run_fmt(snippet.path())
let output = super::run_fmt(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -78,7 +77,7 @@ mod test_deno_fmt {
let snippet = setup_snippet(input, language_to_ext("javascript"))
.expect("it to create a snippet file");

let output = run_fmt(snippet.path())
let output = super::run_fmt(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand All @@ -105,7 +104,7 @@ mod test_deno_fmt {
let snippet = setup_snippet(input, language_to_ext("typescript"))
.expect("it to create a snippet file");

let output = run_fmt(snippet.path())
let output = super::run_fmt(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
7 changes: 2 additions & 5 deletions src/formatters/efmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ pub fn run(file_path: &std::path::Path) -> Result<(bool, Option<String>), MdsfEr

#[cfg(test)]
mod test_efmt {
use crate::{
formatters::{efmt::run, setup_snippet},
generated::language_to_ext,
};
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(efmt)]
fn it_should_format_erlang() {
Expand All @@ -30,7 +27,7 @@ case Erlang of movie->[hello(mike,joe,robert),credits]; language->formatting_arg
let snippet =
setup_snippet(input, language_to_ext("erlang")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
7 changes: 2 additions & 5 deletions src/formatters/elm_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), Mds

#[cfg(test)]
mod test_elm_format {
use crate::{
formatters::{elm_format::run, setup_snippet},
generated::language_to_ext,
};
use crate::{formatters::setup_snippet, generated::language_to_ext};

#[test_with::executable(npx)]
fn it_should_format_elm() {
Expand All @@ -58,7 +55,7 @@ main =
let snippet =
setup_snippet(input, language_to_ext("elm")).expect("it to create a snippet file");

let output = run(snippet.path())
let output = super::run(snippet.path())
.expect("it to be successful")
.1
.expect("it to be some");
Expand Down
Loading
Loading