diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-10-04 13:35:39 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-04 21:35:06 -0700 |
| commit | a8ce543dc937043f2988a856c0c43339eadf8d69 (patch) | |
| tree | c901752717bf2627bc987a4698a5c47918410366 /src/test/stdtest | |
| parent | a0a4d34e141a7a6445457e27fe18d875fb57d9d5 (diff) | |
| download | rust-a8ce543dc937043f2988a856c0c43339eadf8d69.tar.gz rust-a8ce543dc937043f2988a856c0c43339eadf8d69.zip | |
Add std::os::get_exe_path
Need this to correctly determine sysroot in rustc
Diffstat (limited to 'src/test/stdtest')
| -rw-r--r-- | src/test/stdtest/os.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/stdtest/os.rs b/src/test/stdtest/os.rs index 49ebb217dbf..2d17afddc95 100644 --- a/src/test/stdtest/os.rs +++ b/src/test/stdtest/os.rs @@ -28,6 +28,21 @@ fn test_getenv_big() { assert (getenv("NAME3") == option::some(s)); } +#[test] +fn get_exe_path() { + let path = std::os::get_exe_path(); + assert option::is_some(path); + let path = option::get(path); + log path; + + // Hard to test this function + if std::os::target_os() != "win32" { + assert std::str::starts_with(path, std::fs::path_sep()); + } else { + assert path[1] == ':' as u8; + } +} + // Local Variables: // mode: rust; // fill-column: 78; |
