coliru

A minimal, flexible, dotfile installer
git clone https://git.ashermorgan.net/coliru/
Log | Files | Refs | README

local.rs (19082B)


      1 //! End to end tests that test installation behavior on the local file system
      2 
      3 mod test_utils;
      4 
      5 use test_utils::*;
      6 use std::fs::remove_file;
      7 
      8 #[test]
      9 #[cfg(target_family = "unix")]
     10 fn test_local_standard() {
     11     let (dirs, mut cmd) = setup_e2e_local("test_local_standard");
     12     cmd.args(["manifest.yml", "-t", "linux"]);
     13 
     14     let expected = "\
     15 [1/2] Copy gitconfig to ~/.gitconfig
     16 [2/2] Copy foo to foo
     17 [2/2] Link bashrc to ~/.bashrc
     18 [2/2] Link vimrc to ~/.vimrc
     19 [2/2] Run sh script.sh arg1 linux
     20 foo!
     21 ";
     22     let (stdout, stderr, exitcode) = run_command(&mut cmd);
     23     assert_eq!(&stderr, "");
     24     assert_eq!(&stdout, expected);
     25     assert_eq!(exitcode, Some(0));
     26 
     27     // Assert files are correctly copied/linked/run
     28     write_file(&dirs.local.join("bashrc"), "bash #2\n");
     29     write_file(&dirs.local.join("gitconfig"), "git #2\n");
     30     write_file(&dirs.local.join("vimrc"), "vim #2\n");
     31     let bash_contents = read_file(&dirs.home.join(".bashrc"));
     32     let git_contents = read_file(&dirs.home.join(".gitconfig"));
     33     let vim1_contents = read_file(&dirs.home.join(".vimrc"));
     34     let vim2_exists = dirs.home.join("_vimrc").exists();
     35     let foo_contents = read_file(&dirs.local.join("foo"));
     36     let log_contents = read_file(&dirs.local.join("log.txt"));
     37     assert_eq!(bash_contents, "bash #2\n");
     38     assert_eq!(git_contents, "git #1\n");
     39     assert_eq!(vim1_contents, "vim #2\n");
     40     assert_eq!(vim2_exists, false);
     41     assert_eq!(foo_contents, "foo!\n");
     42     assert_eq!(log_contents, "script.sh called with arg1 linux\n");
     43 }
     44 
     45 #[test]
     46 #[cfg(target_family = "windows")]
     47 fn test_local_standard() {
     48     let (dirs, mut cmd) = setup_e2e_local("test_local_standard");
     49     cmd.args(["manifest.yml", "-t", "windows"]);
     50 
     51     let expected = "\
     52 [1/2] Copy gitconfig to .gitconfig
     53 [2/2] Copy foo to foo
     54 [2/2] Link vimrc to _vimrc
     55 [2/2] Run  script.bat arg1 windows
     56 foo!\r
     57 ";
     58     let (stdout, stderr, exitcode) = run_command(&mut cmd);
     59     assert_eq!(&stderr, "");
     60     assert_eq!(&stdout, expected);
     61     assert_eq!(exitcode, Some(0));
     62 
     63     // Assert files are correctly copied/linked/run
     64     write_file(&dirs.local.join("gitconfig"), "git #2\r\n");
     65     write_file(&dirs.local.join("vimrc"), "vim #2\r\n");
     66     let bash_exists = dirs.local.join(".bashrc").exists();
     67     let git_contents = read_file(&dirs.local.join(".gitconfig"));
     68     let vim1_exists = dirs.local.join(".vimrc").exists();
     69     let vim2_contents = read_file(&dirs.local.join("_vimrc"));
     70     let foo_contents = read_file(&dirs.local.join("foo"));
     71     let log_contents = read_file(&dirs.local.join("log.txt"));
     72     assert_eq!(bash_exists, false);
     73     assert_eq!(git_contents, "git #1\r\n");
     74     assert_eq!(vim1_exists, false);
     75     assert_eq!(vim2_contents, "vim #2\r\n");
     76     assert_eq!(foo_contents, "foo!\r\n");
     77     assert_eq!(log_contents, "script.bat called with arg1 windows \r\n");
     78 }
     79 
     80 #[test]
     81 #[cfg(target_family = "unix")]
     82 fn test_local_run_alternate_tag_rules_1() {
     83     let (dirs, mut cmd) = setup_e2e_local("test_local_run_alternate_tag_rules_1");
     84     cmd.args(["manifest.yml", "-t", "linux", "^windows"]);
     85 
     86     let expected = "\
     87 [1/1] Copy foo to foo
     88 [1/1] Link bashrc to ~/.bashrc
     89 [1/1] Link vimrc to ~/.vimrc
     90 [1/1] Run sh script.sh arg1 linux ^windows
     91 foo!
     92 ";
     93     let (stdout, stderr, exitcode) = run_command(&mut cmd);
     94     assert_eq!(&stderr, "");
     95     assert_eq!(&stdout, expected);
     96     assert_eq!(exitcode, Some(0));
     97 
     98     // Assert files are correctly copied/linked/run
     99     write_file(&dirs.local.join("bashrc"), "bash #2\n");
    100     write_file(&dirs.local.join("vimrc"), "vim #2\n");
    101     let bash_contents = read_file(&dirs.home.join(".bashrc"));
    102     let git_exists = dirs.home.join(".gitconfig").exists();
    103     let vim1_contents = read_file(&dirs.home.join(".vimrc"));
    104     let vim2_exists = dirs.home.join("_vimrc").exists();
    105     let foo_contents = read_file(&dirs.local.join("foo"));
    106     let log_contents = read_file(&dirs.local.join("log.txt"));
    107     assert_eq!(bash_contents, "bash #2\n");
    108     assert_eq!(git_exists, false);
    109     assert_eq!(vim1_contents, "vim #2\n");
    110     assert_eq!(vim2_exists, false);
    111     assert_eq!(foo_contents, "foo!\n");
    112     assert_eq!(log_contents, "script.sh called with arg1 linux ^windows\n");
    113 }
    114 
    115 #[test]
    116 #[cfg(target_family = "unix")]
    117 fn test_local_run_alternate_tag_rules_2() {
    118     let (dirs, mut cmd) = setup_e2e_local("test_local_run_alternate_tag_rules_2");
    119     cmd.args(["manifest.yml", "-t", "macos"]);
    120 
    121     let expected = "\
    122 [1/2] Copy gitconfig to ~/.gitconfig
    123 [2/2] Copy foo to foo
    124 [2/2] Link bashrc to ~/.bashrc
    125 [2/2] Link vimrc to ~/.vimrc
    126 [2/2] Run sh script.sh arg1 macos
    127 foo!
    128 ";
    129     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    130     assert_eq!(&stderr, "");
    131     assert_eq!(&stdout, expected);
    132     assert_eq!(exitcode, Some(0));
    133 
    134     // Assert files are correctly copied/linked/run
    135     write_file(&dirs.local.join("bashrc"), "bash #2\n");
    136     write_file(&dirs.local.join("gitconfig"), "git #2\n");
    137     write_file(&dirs.local.join("vimrc"), "vim #2\n");
    138     let bash_contents = read_file(&dirs.home.join(".bashrc"));
    139     let git_contents = read_file(&dirs.home.join(".gitconfig"));
    140     let vim1_contents = read_file(&dirs.home.join(".vimrc"));
    141     let vim2_exists = dirs.home.join("_vimrc").exists();
    142     let foo_contents = read_file(&dirs.local.join("foo"));
    143     let log_contents = read_file(&dirs.local.join("log.txt"));
    144     assert_eq!(bash_contents, "bash #2\n");
    145     assert_eq!(git_contents, "git #1\n");
    146     assert_eq!(vim1_contents, "vim #2\n");
    147     assert_eq!(vim2_exists, false);
    148     assert_eq!(foo_contents, "foo!\n");
    149     assert_eq!(log_contents, "script.sh called with arg1 macos\n");
    150 }
    151 
    152 #[test]
    153 #[cfg(target_family = "unix")]
    154 fn test_local_dry_run() {
    155     let (dirs, mut cmd) = setup_e2e_local("test_local_dry_run");
    156     cmd.args(["manifest.yml", "--dry-run", "-t", "linux"]);
    157 
    158     let expected = "\
    159 [1/2] Copy gitconfig to ~/.gitconfig (DRY RUN)
    160 [2/2] Copy foo to foo (DRY RUN)
    161 [2/2] Link bashrc to ~/.bashrc (DRY RUN)
    162 [2/2] Link vimrc to ~/.vimrc (DRY RUN)
    163 [2/2] Run sh script.sh arg1 linux (DRY RUN)
    164 ";
    165     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    166     assert_eq!(&stderr, "");
    167     assert_eq!(&stdout, expected);
    168     assert_eq!(exitcode, Some(0));
    169 
    170     // Assert files are correctly copied/linked/run
    171     let bash_exists = dirs.home.join(".bashrc").exists();
    172     let git_exists = dirs.home.join(".gitconfig").exists();
    173     let vim1_exists = dirs.home.join(".vimrc").exists();
    174     let vim2_exists = dirs.home.join("_vimrc").exists();
    175     let foo_exists = dirs.local.join("foo").exists();
    176     let log_exists = dirs.local.join("log.txt").exists();
    177     assert_eq!(bash_exists, false);
    178     assert_eq!(git_exists, false);
    179     assert_eq!(vim1_exists, false);
    180     assert_eq!(vim2_exists, false);
    181     assert_eq!(foo_exists, true);
    182     assert_eq!(log_exists, false);
    183 }
    184 
    185 #[test]
    186 #[cfg(target_family = "windows")]
    187 fn test_local_dry_run() {
    188     let (dirs, mut cmd) = setup_e2e_local("test_local_dry_run");
    189     cmd.args(["manifest.yml", "--dry-run", "-t", "windows"]);
    190 
    191     let expected = "\
    192 [1/2] Copy gitconfig to .gitconfig (DRY RUN)
    193 [2/2] Copy foo to foo (DRY RUN)
    194 [2/2] Link vimrc to _vimrc (DRY RUN)
    195 [2/2] Run  script.bat arg1 windows (DRY RUN)
    196 ";
    197     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    198     assert_eq!(&stderr, "");
    199     assert_eq!(&stdout, expected);
    200     assert_eq!(exitcode, Some(0));
    201 
    202     // Assert files are correctly copied/linked/run
    203     let bash_exists = dirs.local.join(".bashrc").exists();
    204     let git_exists = dirs.local.join(".gitconfig").exists();
    205     let vim1_exists = dirs.local.join(".vimrc").exists();
    206     let vim2_exists = dirs.local.join("_vimrc").exists();
    207     let foo_exists = dirs.local.join("foo").exists();
    208     let log_exists = dirs.local.join("log.txt").exists();
    209     assert_eq!(bash_exists, false);
    210     assert_eq!(git_exists, false);
    211     assert_eq!(vim1_exists, false);
    212     assert_eq!(vim2_exists, false);
    213     assert_eq!(foo_exists, true);
    214     assert_eq!(log_exists, false);
    215 }
    216 
    217 #[test]
    218 #[cfg(target_family = "unix")]
    219 fn test_local_copy() {
    220     let (dirs, mut cmd) = setup_e2e_local("test_local_copy");
    221     cmd.args(["manifest.yml", "--copy", "-t", "linux"]);
    222 
    223     let expected = "\
    224 [1/2] Copy gitconfig to ~/.gitconfig
    225 [2/2] Copy foo to foo
    226 [2/2] Copy bashrc to ~/.bashrc
    227 [2/2] Copy vimrc to ~/.vimrc
    228 [2/2] Run sh script.sh arg1 linux
    229 foo!
    230 ";
    231     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    232     assert_eq!(&stderr, "");
    233     assert_eq!(&stdout, expected);
    234     assert_eq!(exitcode, Some(0));
    235 
    236     // Assert files are correctly copied/linked/run
    237     write_file(&dirs.local.join("bashrc"), "bash #2\n");
    238     write_file(&dirs.local.join("gitconfig"), "git #2\n");
    239     write_file(&dirs.local.join("vimrc"), "vim #2\n");
    240     let bash_contents = read_file(&dirs.home.join(".bashrc"));
    241     let git_contents = read_file(&dirs.home.join(".gitconfig"));
    242     let vim1_contents = read_file(&dirs.home.join(".vimrc"));
    243     let vim2_exists = dirs.home.join("_vimrc").exists();
    244     let foo_contents = read_file(&dirs.local.join("foo"));
    245     let log_contents = read_file(&dirs.local.join("log.txt"));
    246     assert_eq!(bash_contents, "bash #1\n");
    247     assert_eq!(git_contents, "git #1\n");
    248     assert_eq!(vim1_contents, "vim #1\n");
    249     assert_eq!(vim2_exists, false);
    250     assert_eq!(foo_contents, "foo!\n");
    251     assert_eq!(log_contents, "script.sh called with arg1 linux\n");
    252 }
    253 
    254 #[test]
    255 #[cfg(target_family = "windows")]
    256 fn test_local_copy() {
    257     let (dirs, mut cmd) = setup_e2e_local("test_local_copy");
    258     cmd.args(["manifest.yml", "--copy", "-t", "windows"]);
    259 
    260     let expected = "\
    261 [1/2] Copy gitconfig to .gitconfig
    262 [2/2] Copy foo to foo
    263 [2/2] Copy vimrc to _vimrc
    264 [2/2] Run  script.bat arg1 windows
    265 foo!\r
    266 ";
    267     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    268     assert_eq!(&stderr, "");
    269     assert_eq!(&stdout, expected);
    270     assert_eq!(exitcode, Some(0));
    271 
    272     // Assert files are correctly copied/linked/run
    273     write_file(&dirs.local.join("gitconfig"), "git #2\r\n");
    274     write_file(&dirs.local.join("vimrc"), "vim #2\r\n");
    275     let bash_exists = dirs.local.join(".bashrc").exists();
    276     let git_contents = read_file(&dirs.local.join(".gitconfig"));
    277     let vim1_exists = dirs.local.join(".vimrc").exists();
    278     let vim2_contents = read_file(&dirs.local.join("_vimrc"));
    279     let foo_contents = read_file(&dirs.local.join("foo"));
    280     let log_contents = read_file(&dirs.local.join("log.txt"));
    281     assert_eq!(bash_exists, false);
    282     assert_eq!(git_contents, "git #1\r\n");
    283     assert_eq!(vim1_exists, false);
    284     assert_eq!(vim2_contents, "vim #1\r\n");
    285     assert_eq!(foo_contents, "foo!\r\n");
    286     assert_eq!(log_contents, "script.bat called with arg1 windows \r\n");
    287 }
    288 
    289 #[test]
    290 #[cfg(target_family = "unix")]
    291 fn test_local_run_failure() {
    292     let (dirs, mut cmd) = setup_e2e_local("test_local_run_failure");
    293     cmd.args(["manifest.yml", "-t", "linux"]);
    294     write_file(&dirs.local.join("script.sh"), "exit 1");
    295 
    296     let expected_stdout = "\
    297 [1/2] Copy gitconfig to ~/.gitconfig
    298 [2/2] Copy foo to foo
    299 [2/2] Link bashrc to ~/.bashrc
    300 [2/2] Link vimrc to ~/.vimrc
    301 [2/2] Run sh script.sh arg1 linux
    302 ";
    303     let expected_stderr = "  Error: Process terminated unsuccessfully: \
    304                            exit status: 1\n";
    305     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    306     assert_eq!(&stderr, expected_stderr);
    307     assert_eq!(&stdout, expected_stdout);
    308     assert_eq!(exitcode, Some(1));
    309 
    310     // Assert files are correctly copied/linked/run
    311     write_file(&dirs.local.join("bashrc"), "bash #2\n");
    312     write_file(&dirs.local.join("gitconfig"), "git #2\n");
    313     write_file(&dirs.local.join("vimrc"), "vim #2\n");
    314     let bash_contents = read_file(&dirs.home.join(".bashrc"));
    315     let git_contents = read_file(&dirs.home.join(".gitconfig"));
    316     let vim1_contents = read_file(&dirs.home.join(".vimrc"));
    317     let vim2_exists = dirs.home.join("_vimrc").exists();
    318     let foo_contents = read_file(&dirs.local.join("foo"));
    319     assert_eq!(bash_contents, "bash #2\n");
    320     assert_eq!(git_contents, "git #1\n");
    321     assert_eq!(vim1_contents, "vim #2\n");
    322     assert_eq!(vim2_exists, false);
    323     assert_eq!(foo_contents, "foo!\n");
    324 }
    325 
    326 #[test]
    327 #[cfg(target_family = "windows")]
    328 fn test_local_run_failure() {
    329     let (dirs, mut cmd) = setup_e2e_local("test_local_run_failure");
    330     cmd.args(["manifest.yml", "-t", "windows"]);
    331     write_file(&dirs.local.join("script.bat"), "@echo off\r\nexit 1");
    332 
    333     let expected_stdout = "\
    334 [1/2] Copy gitconfig to .gitconfig
    335 [2/2] Copy foo to foo
    336 [2/2] Link vimrc to _vimrc
    337 [2/2] Run  script.bat arg1 windows
    338 ";
    339     let expected_stderr = "  Error: Process terminated unsuccessfully: \
    340                            exit code: 1\n";
    341     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    342     assert_eq!(&stderr, expected_stderr);
    343     assert_eq!(&stdout, expected_stdout);
    344     assert_eq!(exitcode, Some(1));
    345 
    346     // Assert files are correctly copied/linked/run
    347     write_file(&dirs.local.join("gitconfig"), "git #2\r\n");
    348     write_file(&dirs.local.join("vimrc"), "vim #2\r\n");
    349     let bash_exists = dirs.local.join(".bashrc").exists();
    350     let git_contents = read_file(&dirs.local.join(".gitconfig"));
    351     let vim1_exists = dirs.local.join(".vimrc").exists();
    352     let vim2_contents = read_file(&dirs.local.join("_vimrc"));
    353     let foo_contents = read_file(&dirs.local.join("foo"));
    354     assert_eq!(bash_exists, false);
    355     assert_eq!(git_contents, "git #1\r\n");
    356     assert_eq!(vim1_exists, false);
    357     assert_eq!(vim2_contents, "vim #2\r\n");
    358     assert_eq!(foo_contents, "foo!\r\n");
    359 }
    360 
    361 #[test]
    362 #[cfg(target_family = "unix")]
    363 fn test_local_missing_file() {
    364     let (dirs, mut cmd) = setup_e2e_local("test_local_missing_file");
    365     cmd.args(["manifest.yml", "-t", "linux"]);
    366     remove_file(&dirs.local.join("gitconfig")).unwrap();
    367 
    368     let expected_stdout = "\
    369 [1/2] Copy gitconfig to ~/.gitconfig
    370 [2/2] Copy foo to foo
    371 [2/2] Link bashrc to ~/.bashrc
    372 [2/2] Link vimrc to ~/.vimrc
    373 [2/2] Run sh script.sh arg1 linux
    374 foo!
    375 ";
    376     let expected_stderr = "  Error: No such file or directory (os error 2)\n";
    377     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    378     assert_eq!(&stderr, expected_stderr);
    379     assert_eq!(&stdout, expected_stdout);
    380     assert_eq!(exitcode, Some(1));
    381 
    382     // Assert files are correctly copied/linked/run
    383     write_file(&dirs.local.join("bashrc"), "bash #2\n");
    384     write_file(&dirs.local.join("vimrc"), "vim #2\n");
    385     let bash_contents = read_file(&dirs.home.join(".bashrc"));
    386     let vim1_contents = read_file(&dirs.home.join(".vimrc"));
    387     let vim2_exists = dirs.home.join("_vimrc").exists();
    388     let foo_contents = read_file(&dirs.local.join("foo"));
    389     let log_contents = read_file(&dirs.local.join("log.txt"));
    390     assert_eq!(bash_contents, "bash #2\n");
    391     assert_eq!(vim1_contents, "vim #2\n");
    392     assert_eq!(vim2_exists, false);
    393     assert_eq!(foo_contents, "foo!\n");
    394     assert_eq!(log_contents, "script.sh called with arg1 linux\n");
    395 }
    396 
    397 #[test]
    398 #[cfg(target_family = "windows")]
    399 fn test_local_missing_file() {
    400     let (dirs, mut cmd) = setup_e2e_local("test_local_missing_file");
    401     cmd.args(["manifest.yml", "-t", "windows"]);
    402     remove_file(&dirs.local.join("vimrc")).unwrap();
    403 
    404     let expected_stdout = "\
    405 [1/2] Copy gitconfig to .gitconfig
    406 [2/2] Copy foo to foo
    407 [2/2] Link vimrc to _vimrc
    408 [2/2] Run  script.bat arg1 windows
    409 foo!\r
    410 ";
    411     let expected_stderr = "  Error: The system cannot find the file specified. \
    412                            (os error 2)\n";
    413     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    414     assert_eq!(&stderr, expected_stderr);
    415     assert_eq!(&stdout, expected_stdout);
    416     assert_eq!(exitcode, Some(1));
    417 
    418     // Assert files are correctly copied/linked/run
    419     write_file(&dirs.local.join("gitconfig"), "git #2\r\n");
    420     let bash_exists = dirs.local.join(".bashrc").exists();
    421     let git_contents = read_file(&dirs.local.join(".gitconfig"));
    422     let foo_contents = read_file(&dirs.local.join("foo"));
    423     let log_contents = read_file(&dirs.local.join("log.txt"));
    424     assert_eq!(bash_exists, false);
    425     assert_eq!(git_contents, "git #1\r\n");
    426     assert_eq!(foo_contents, "foo!\r\n");
    427     assert_eq!(log_contents, "script.bat called with arg1 windows \r\n");
    428 }
    429 
    430 #[test]
    431 #[cfg(target_family = "unix")]
    432 fn test_local_relative_manifest() {
    433     let (dirs, mut cmd) = setup_e2e_local("test_local_relative_manifest");
    434     cmd.current_dir(&dirs.local.parent().unwrap());
    435     cmd.args(["test_local_relative_manifest/manifest.yml", "-t", "linux"]);
    436 
    437     let expected = "\
    438 [1/2] Copy gitconfig to ~/.gitconfig
    439 [2/2] Copy foo to foo
    440 [2/2] Link bashrc to ~/.bashrc
    441 [2/2] Link vimrc to ~/.vimrc
    442 [2/2] Run sh script.sh arg1 linux
    443 foo!
    444 ";
    445     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    446     assert_eq!(&stderr, "");
    447     assert_eq!(&stdout, expected);
    448     assert_eq!(exitcode, Some(0));
    449 
    450     // Assert files are correctly copied/linked/run
    451     write_file(&dirs.local.join("bashrc"), "bash #2\n");
    452     write_file(&dirs.local.join("gitconfig"), "git #2\n");
    453     write_file(&dirs.local.join("vimrc"), "vim #2\n");
    454     let bash_contents = read_file(&dirs.home.join(".bashrc"));
    455     let git_contents = read_file(&dirs.home.join(".gitconfig"));
    456     let vim1_contents = read_file(&dirs.home.join(".vimrc"));
    457     let vim2_exists = dirs.home.join("_vimrc").exists();
    458     let foo_contents = read_file(&dirs.local.join("foo"));
    459     let log_contents = read_file(&dirs.local.join("log.txt"));
    460     assert_eq!(bash_contents, "bash #2\n");
    461     assert_eq!(git_contents, "git #1\n");
    462     assert_eq!(vim1_contents, "vim #2\n");
    463     assert_eq!(vim2_exists, false);
    464     assert_eq!(foo_contents, "foo!\n");
    465     assert_eq!(log_contents, "script.sh called with arg1 linux\n");
    466 }
    467 
    468 #[test]
    469 #[cfg(target_family = "windows")]
    470 fn test_local_different_cwd() {
    471     let (dirs, mut cmd) = setup_e2e_local("test_local_different_cwd");
    472     cmd.current_dir(&dirs.local.parent().unwrap());
    473     cmd.args(["test_local_different_cwd/manifest.yml", "-t", "windows"]);
    474 
    475     let expected = "\
    476 [1/2] Copy gitconfig to .gitconfig
    477 [2/2] Copy foo to foo
    478 [2/2] Link vimrc to _vimrc
    479 [2/2] Run  script.bat arg1 windows
    480 foo!\r
    481 ";
    482     let (stdout, stderr, exitcode) = run_command(&mut cmd);
    483     assert_eq!(&stderr, "");
    484     assert_eq!(&stdout, expected);
    485     assert_eq!(exitcode, Some(0));
    486 
    487     // Assert files are correctly copied/linked/run
    488     write_file(&dirs.local.join("gitconfig"), "git #2\r\n");
    489     write_file(&dirs.local.join("vimrc"), "vim #2\r\n");
    490     let bash_exists = dirs.local.join(".bashrc").exists();
    491     let git_contents = read_file(&dirs.local.join(".gitconfig"));
    492     let vim1_exists = dirs.local.join(".vimrc").exists();
    493     let vim2_contents = read_file(&dirs.local.join("_vimrc"));
    494     let foo_contents = read_file(&dirs.local.join("foo"));
    495     let log_contents = read_file(&dirs.local.join("log.txt"));
    496     assert_eq!(bash_exists, false);
    497     assert_eq!(git_contents, "git #1\r\n");
    498     assert_eq!(vim1_exists, false);
    499     assert_eq!(vim2_contents, "vim #2\r\n");
    500     assert_eq!(foo_contents, "foo!\r\n");
    501     assert_eq!(log_contents, "script.bat called with arg1 windows \r\n");
    502 }