Skip to content

Commit c568aa3

Browse files
committed
test: fix tests on macos
1 parent 77bd540 commit c568aa3

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.github/workflows/CI.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
strategy:
1919
matrix:
2020
include:
21-
# - os: macos-latest
22-
# target: x86_64-osx
21+
- os: macos-latest
22+
target: x86_64-osx
2323
- os: ubuntu-latest
2424
target: x86_64-unknown-linux-gnu
2525
coverage: true

src/dots.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,10 @@ mod tests {
306306

307307
fn setup(dotfiles: &str) {
308308
env::set_var("HOME", env::current_dir().unwrap());
309+
#[cfg(target_os = "macos")]
310+
run_cmd!(mkdir -p "Library/Application Support";).unwrap();
309311
println!("Fake home: {}", env::var("HOME").unwrap());
310-
run_cmd!(
311-
mkdir .config;
312-
)
313-
.unwrap();
312+
run_cmd!(mkdir .config;).unwrap();
314313

315314
Bombadil::link_self_config(Some(PathBuf::from(dotfiles))).unwrap();
316315
}
@@ -423,7 +422,7 @@ mod tests {
423422
vars: Dot::default_vars(),
424423
};
425424

426-
run_cmd! {ls -larth}?;
425+
run_cmd! {ls -larth;}?;
427426

428427
dot.traverse_and_copy(
429428
&source,
@@ -598,10 +597,9 @@ mod tests {
598597
Ok(())
599598
}
600599

601-
#[sealed_test(files = ["tests/dotfiles_with_local_vars"], env = [("HOME", ".")])]
600+
#[sealed_test(files = ["tests/dotfiles_with_local_vars"], env = [("HOME", ".")], before = setup("dotfiles_with_local_vars"))]
602601
fn install_with_local_vars_default_path() -> Result<()> {
603602
run_cmd!(
604-
mkdir .config;
605603
mkdir dotfiles_with_local_vars/source_dot;
606604
echo "{{name}} is {{verb}}" > dotfiles_with_local_vars/source_dot/file;
607605
echo "name=\"Tom\"" > dotfiles_with_local_vars/source_dot/vars.toml;

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ mod tests {
689689
fn setup(dotfiles: &str) {
690690
let home_dir = env::current_dir().unwrap().canonicalize().unwrap();
691691
env::set_var("HOME", home_dir);
692+
693+
#[cfg(target_os = "macos")]
694+
run_cmd!(mkdir -p "Library/Application Support";).unwrap();
695+
692696
run_cmd!(
693697
mkdir .config;
694698
)

0 commit comments

Comments
 (0)