Skip to content

Commit

Permalink
Mark template tests with cfg directives
Browse files Browse the repository at this point in the history
  • Loading branch information
mataha committed May 11, 2023
1 parent d630c7c commit 2972aac
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn bash_bash(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Bash(&opts).render().unwrap();
Expand All @@ -66,6 +67,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn bash_shellcheck(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Bash(&opts).render().unwrap();
Expand All @@ -80,6 +82,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn bash_shfmt(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Bash(&opts).render().unwrap();
Expand All @@ -95,6 +98,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(windows)]
fn cmd_cmd(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Cmd(&opts).render().unwrap();
Expand All @@ -111,6 +115,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = String::new();
Expand All @@ -133,6 +138,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn fish_fish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Fish(&opts).render().unwrap();
Expand All @@ -150,6 +156,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn fish_fishindent(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Fish(&opts).render().unwrap();
Expand All @@ -168,6 +175,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn nushell_nushell(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Nushell(&opts).render().unwrap();
Expand All @@ -188,6 +196,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn posix_bash(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Posix(&opts).render().unwrap();
Expand All @@ -203,6 +212,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn posix_dash(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Posix(&opts).render().unwrap();
Expand All @@ -215,7 +225,8 @@ mod tests {
}

#[apply(opts)]
fn posix_shellcheck_(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
#[cfg(unix)]
fn posix_shellcheck(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Posix(&opts).render().unwrap();

Expand All @@ -229,6 +240,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn posix_shfmt(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Posix(&opts).render().unwrap();
Expand All @@ -244,6 +256,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn powershell_pwsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = "Set-StrictMode -Version latest\n".to_string();
Expand All @@ -258,6 +271,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn xonsh_black(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Xonsh(&opts).render().unwrap();
Expand All @@ -272,6 +286,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn xonsh_mypy(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Xonsh(&opts).render().unwrap();
Expand All @@ -280,6 +295,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn xonsh_pylint(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Xonsh(&opts).render().unwrap();
Expand All @@ -294,6 +310,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn xonsh_xonsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Xonsh(&opts).render().unwrap();
Expand All @@ -311,6 +328,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn zsh_shellcheck(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Zsh(&opts).render().unwrap();
Expand All @@ -326,6 +344,7 @@ mod tests {
}

#[apply(opts)]
#[cfg(unix)]
fn zsh_zsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Zsh(&opts).render().unwrap();
Expand Down

0 comments on commit 2972aac

Please sign in to comment.