]> git.lizzy.rs Git - rust.git/commitdiff
libstd: Add unit tests for `slice_shift_char`
authorPiotr Czarnecki <pioczarn@gmail.com>
Sun, 9 Mar 2014 21:56:33 +0000 (22:56 +0100)
committerPiotr Czarnecki <pioczarn@gmail.com>
Mon, 10 Mar 2014 12:55:02 +0000 (13:55 +0100)
src/libstd/str.rs

index 57b3dc3a252496cc605831e624b72d208bf62608..f5bd7e75c3aa69cd2a3d50336f7e6f5eda569fb4 100644 (file)
@@ -3618,6 +3618,18 @@ fn test_is_whitespace() {
         assert!(!"   _   ".is_whitespace());
     }
 
+    #[test]
+    fn test_slice_shift_char() {
+        let data = "ประเทศไทย中";
+        assert_eq!(data.slice_shift_char(), (Some('ป'), "ระเทศไทย中"));
+    }
+
+    #[test]
+    fn test_slice_shift_char_2() {
+        let empty = "";
+        assert_eq!(empty.slice_shift_char(), (None, ""));
+    }
+
     #[test]
     fn test_push_byte() {
         let mut s = ~"ABC";