Skip to content

Commit df25b76

Browse files
committed
Add test for macos arrays
1 parent 1a99fcf commit df25b76

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

crates/mac_core/src/array.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,22 @@ impl<T: CoreType> CFArray<T> {
7171
unsafe { T::new_borrowed(ptr.cast()) }
7272
}
7373
}
74+
75+
#[cfg(test)]
76+
mod tests {
77+
use super::*;
78+
use crate::CFString;
79+
80+
#[test]
81+
fn test_array_index() {
82+
let foo = CFString::new("foo");
83+
let bar = CFString::new("bar");
84+
85+
let arr = CFArray::new(&[foo.clone(), bar.clone()]);
86+
87+
assert_eq!(arr[0].as_type_ref(), foo.as_type_ref());
88+
assert_eq!(arr[1].as_type_ref(), bar.as_type_ref());
89+
assert_eq!(arr[0].as_str(), "foo");
90+
assert_eq!(arr[1].as_str(), "bar");
91+
}
92+
}

0 commit comments

Comments
 (0)