We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6adc78 commit 748aa2fCopy full SHA for 748aa2f
capnp/tests/text_comparisons.rs
@@ -0,0 +1,22 @@
1
+#![cfg(feature = "alloc")]
2
+
3
+use capnp::{message, text};
4
5
+#[test]
6
+pub fn text_comparisons() {
7
+ let mut msg1 = message::Builder::new_default();
8
+ let mut msg2 = message::Builder::new_default();
9
10
+ msg1.set_root::<text::Reader>("abcde".into()).unwrap();
11
+ msg2.set_root::<text::Reader>("fghij".into()).unwrap();
12
13
+ let str1 = msg1.get_root_as_reader::<text::Reader>().unwrap();
14
+ let str2 = msg2.get_root_as_reader::<text::Reader>().unwrap();
15
16
+ assert!(str1 < str2);
17
+ assert!(str1 < "zzzz");
18
+ assert!("aaaa" < str2);
19
+ assert_eq!(str1, "abcde");
20
+ assert_eq!("fghij", str2);
21
+ assert_ne!(str1, str2);
22
+}
0 commit comments