makepad/libs/relax/compiler/tests/std/std_arc_path.rs
Admin b22a714840 makepad run: the Rust JIT (libs/relax) and makepad-remote
The JIT that runs makepad apps from source: lexer, front end, type checker,
lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and
warm/cold caches keyed by compiler stamp, provided crates bound late,
startup images, live patching. User-facing name is `makepad run` (binary
`makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal
library name. `makepad check` reports rustc-style diagnostics with rustc
error codes and checks a whole workspace (`--workspace`). Runs on macOS,
Linux, Windows and Android. makepad-remote: one tool schema for apps and the
WM (app/1): grabs, captures, traces, frame profiles and tweaks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 12:26:21 +02:00

24 lines
1,008 B
Rust

// Arc<Path>/Rc<Path>/Arc<OsStr>/Rc<OsStr> from borrowed and owned values, as real std
// (bzip2-sys's build script: `Arc::<Path>::from(&*path)`). "| " lines must equal real std's (core_diff.sh).
use std::ffi::{OsStr, OsString};
use std::path::{Path, PathBuf};
use std::rc::Rc;
use std::sync::Arc;
#[test]
fn a01_arc_path() {
let a: Arc<Path> = Arc::from(Path::new("/usr/lib/x.so"));
let b: Arc<Path> = PathBuf::from("rel/dir").into();
let c = a.clone();
println!("| {} {} {} {}", a.display(), b.display(), Arc::strong_count(&a), c.extension().unwrap().to_str().unwrap());
let e: Arc<Path> = Arc::from(Path::new(""));
println!("| empty {}", e.as_os_str().len());
}
#[test]
fn a02_rc_path_and_os_str() {
let r: Rc<Path> = Rc::from(Path::new("a/b.txt"));
let o: Arc<OsStr> = Arc::from(OsStr::new("osstr"));
let p: Rc<OsStr> = OsString::from("owned").into();
println!("| {} {} {}", r.file_name().unwrap().to_str().unwrap(), o.to_str().unwrap(), p.to_str().unwrap());
}