Initial public release of Warp.
Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parse_uname_linux_x86_64() {
|
||||
let platform = parse_uname_output("Linux x86_64").unwrap();
|
||||
assert_eq!(platform.os, RemoteOs::Linux);
|
||||
assert_eq!(platform.arch, RemoteArch::X86_64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_linux_aarch64() {
|
||||
let platform = parse_uname_output("Linux aarch64").unwrap();
|
||||
assert_eq!(platform.os, RemoteOs::Linux);
|
||||
assert_eq!(platform.arch, RemoteArch::Aarch64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_darwin_arm64() {
|
||||
let platform = parse_uname_output("Darwin arm64").unwrap();
|
||||
assert_eq!(platform.os, RemoteOs::MacOs);
|
||||
assert_eq!(platform.arch, RemoteArch::Aarch64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_darwin_x86_64() {
|
||||
let platform = parse_uname_output("Darwin x86_64").unwrap();
|
||||
assert_eq!(platform.os, RemoteOs::MacOs);
|
||||
assert_eq!(platform.arch, RemoteArch::X86_64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_linux_armv8l() {
|
||||
let platform = parse_uname_output("Linux armv8l").unwrap();
|
||||
assert_eq!(platform.os, RemoteOs::Linux);
|
||||
assert_eq!(platform.arch, RemoteArch::Aarch64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_skips_shell_initialization_output() {
|
||||
let output = "Last login: Mon Apr 7 10:00:00 2025\nWelcome to Ubuntu\nLinux x86_64";
|
||||
let platform = parse_uname_output(output).unwrap();
|
||||
assert_eq!(platform.os, RemoteOs::Linux);
|
||||
assert_eq!(platform.arch, RemoteArch::X86_64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_trims_whitespace() {
|
||||
let platform = parse_uname_output(" Linux x86_64 \n").unwrap();
|
||||
assert_eq!(platform.os, RemoteOs::Linux);
|
||||
assert_eq!(platform.arch, RemoteArch::X86_64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_unsupported_os() {
|
||||
let result = parse_uname_output("Windows x86_64");
|
||||
assert!(result.is_err());
|
||||
assert!(result.unwrap_err().to_string().contains("unsupported OS"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_unsupported_arch() {
|
||||
let result = parse_uname_output("Linux mips");
|
||||
assert!(result.is_err());
|
||||
assert!(result.unwrap_err().to_string().contains("unsupported arch"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_empty_output() {
|
||||
let result = parse_uname_output("");
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_uname_missing_arch() {
|
||||
let result = parse_uname_output("Linux");
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn state_is_ready() {
|
||||
assert!(RemoteServerSetupState::Ready.is_ready());
|
||||
assert!(!RemoteServerSetupState::Checking.is_ready());
|
||||
assert!(!RemoteServerSetupState::Initializing.is_ready());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn state_is_failed() {
|
||||
assert!(RemoteServerSetupState::Failed {
|
||||
error: "test".into()
|
||||
}
|
||||
.is_failed());
|
||||
assert!(!RemoteServerSetupState::Ready.is_failed());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn state_is_terminal() {
|
||||
assert!(RemoteServerSetupState::Ready.is_terminal());
|
||||
assert!(RemoteServerSetupState::Failed {
|
||||
error: "test".into()
|
||||
}
|
||||
.is_terminal());
|
||||
assert!(!RemoteServerSetupState::Checking.is_terminal());
|
||||
assert!(!RemoteServerSetupState::Installing {
|
||||
progress_percent: None
|
||||
}
|
||||
.is_terminal());
|
||||
assert!(!RemoteServerSetupState::Initializing.is_terminal());
|
||||
}
|
||||
Reference in New Issue
Block a user