mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 15:49:40 +00:00
feat: Refactor builder modules by consolidating Unix C/C++ compilers, extracting common logic, enhancing MSVC with dependency tracking, and adding new CLI error tests.
This commit is contained in:
@@ -18,3 +18,61 @@ pub fn shared_lib_path(profile: &str, name: &str, target_dir: Option<&str>) -> S
|
||||
None => format!("./target/{profile}/lib{name}.so"),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn bin_path_default() {
|
||||
assert_eq!(bin_path("debug", "hello", None), "./target/debug/hello");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bin_path_release() {
|
||||
assert_eq!(
|
||||
bin_path("release", "hello", None),
|
||||
"./target/release/hello"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bin_path_custom_target() {
|
||||
assert_eq!(bin_path("debug", "hello", Some("out")), "out/hello");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bin_path_custom_target_trailing_slash() {
|
||||
assert_eq!(bin_path("debug", "hello", Some("out/")), "out/hello");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_path_default() {
|
||||
assert_eq!(
|
||||
lib_path("debug", "mylib", None),
|
||||
"./target/debug/libmylib.a"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_path_custom_target() {
|
||||
assert_eq!(lib_path("debug", "mylib", Some("out")), "out/libmylib.a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shared_lib_path_default() {
|
||||
assert_eq!(
|
||||
shared_lib_path("debug", "mylib", None),
|
||||
"./target/debug/libmylib.so"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shared_lib_path_custom_target() {
|
||||
assert_eq!(
|
||||
shared_lib_path("release", "mylib", Some("dist")),
|
||||
"dist/libmylib.so"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user