message: test(binaryinstall): Windows specific tests
diff: @@ -29,7 +29,8 @@ fn it_returns_binary_name_for_unix() {
  }
  #[test]
  -fn it_bails_if_not_file() {
  +#[cfg(not(windows))]
  +fn it_bails_if_not_file_for_unix() {
  let binary_name = "wasm-pack";
  let dir = tempfile::TempDir::new().unwrap();
  @@ -51,7 +52,31 @@ fn it_bails_if_not_file() {
  }
  #[test]
  -fn it_bails_if_not_executable() {
  +#[cfg(windows)]
  +fn it_bails_if_not_file_for_windows() {
  + let binary_name = "wasm-pack.exe";
  +
  + let dir = tempfile::TempDir::new().unwrap();
  + let download = Download::at(dir.path());
  +
  + let full_path = dir.path().join(binary_name);
  +
  + let mut options = OpenOptions::new();
  + options.create(true);
  + options.write(true);
  +
  + let binary = download.binary(binary_name);
  +
  + assert!(binary.is_err());
  + assert_eq!(
  + format!("{} binary does not exist", full_path.to_str().unwrap()),
  + binary.unwrap_err().to_string()
  + );
  +}
  +
  +#[test]
  +#[cfg(not(windows))]
  +fn it_bails_if_not_executable_for_unix() {
  let binary_name = "wasm-pack";
  let dir = tempfile::TempDir::new().unwrap();
  @@ -73,3 +98,28 @@ fn it_bails_if_not_executable() {
  binary.unwrap_err().to_string()
  );
  }
  +
  +#[test]
  +#[cfg(windows)]
  +fn it_bails_if_not_executable_for_windows() {
  + let binary_name = "wasm-pack.exe";
  +
  + let dir = tempfile::TempDir::new().unwrap();
  + let download = Download::at(dir.path());
  +
  + let full_path = dir.path().join(binary_name);
  +
  + let mut options = OpenOptions::new();
  + options.create(true);
  + options.write(true);
  +
  + options.open(&full_path).unwrap();
  +
  + let binary = download.binary(binary_name);
  +
  + assert!(binary.is_err());
  + assert_eq!(
  + format!("{} is not executable", full_path.to_str().unwrap()),
  + binary.unwrap_err().to_string()
  + );
  +}
  