Skip to content

Commit 336b670

Browse files
committed
Improve ns_string! testing a bit
1 parent 319ee79 commit 336b670

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

objc2-foundation/src/__string_macro.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl Utf16Char {
117117
}
118118

119119
#[cfg(test)]
120-
pub fn as_slice(&self) -> &[u16] {
120+
fn as_slice(&self) -> &[u16] {
121121
&self.repr[..self.len]
122122
}
123123
}
@@ -406,7 +406,13 @@ mod tests {
406406
macro_rules! test {
407407
($($s:expr,)+) => {$({
408408
static STRING: &NSString = ns_string!($s);
409+
let s = NSString::from_str($s);
410+
411+
assert_eq!(STRING, STRING);
412+
assert_eq!(STRING, &*s);
413+
409414
assert_eq!(STRING.to_string(), $s);
415+
assert_eq!(s.to_string(), $s);
410416
})+};
411417
}
412418

@@ -424,6 +430,7 @@ mod tests {
424430
"讓每個人都能打造出。",
425431
"\0",
426432
"\0\x01\x02\x03\x04\x05\x06\x07\x08\x09",
433+
// "\u{feff}", // TODO
427434
}
428435
}
429436

0 commit comments

Comments
 (0)