tests and tooling (#4)

* init openspec

* clean out src, move mod into lib, remove trash

* create tests

* pre-commit hook

* add tests to CI

* update website

* README, CONTRIBUTING and Makefile

* openspec

* archive task

* fix ci order

* fix integration test

* fix validation tests
This commit is contained in:
Hari 2026-03-25 19:29:59 -04:00 committed by GitHub
parent 7dfab68304
commit 3819a85c47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 892 additions and 286 deletions

View file

@ -136,8 +136,12 @@ impl RefMap {
/// Resolve a selector to the center coordinates of the window.
pub fn resolve_to_center(&self, selector: &str) -> Option<(i32, i32)> {
self.resolve(selector)
.map(|entry| (entry.x + entry.width as i32 / 2, entry.y + entry.height as i32 / 2))
self.resolve(selector).map(|entry| {
(
entry.x + entry.width as i32 / 2,
entry.y + entry.height as i32 / 2,
)
})
}
pub fn entries(&self) -> impl Iterator<Item = (&String, &RefEntry)> {
@ -182,7 +186,10 @@ mod tests {
assert_eq!(refs.resolve("@w1").unwrap().window_id, window_id);
assert_eq!(refs.resolve(&window_id).unwrap().backend_window_id, 42);
assert_eq!(refs.resolve(&format!("id={window_id}")).unwrap().title, "Editor");
assert_eq!(
refs.resolve(&format!("id={window_id}")).unwrap().title,
"Editor"
);
}
#[test]