about summary refs log tree commit diff
path: root/library/coretests/tests/ascii_char.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/coretests/tests/ascii_char.rs')
-rw-r--r--library/coretests/tests/ascii_char.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/library/coretests/tests/ascii_char.rs b/library/coretests/tests/ascii_char.rs
index 75b5fd4b9e6..f5a15a9469f 100644
--- a/library/coretests/tests/ascii_char.rs
+++ b/library/coretests/tests/ascii_char.rs
@@ -26,3 +26,15 @@ fn test_debug_control() {
         assert_eq!(want, format!("{chr:?}"), "byte: {byte}");
     }
 }
+
+/// Tests Extend implementation for ascii::Char.
+#[test]
+fn test_extend() {
+    let mut s = String::from("abc");
+    s.extend_one(Char::SmallD);
+    assert_eq!(s, String::from("abcd"));
+
+    let mut s = String::from("abc");
+    s.extend(Char::CapitalA..=Char::CapitalC);
+    assert_eq!(s, String::from("abcABC"));
+}