about summary refs log tree commit diff
path: root/library/core/tests/ascii.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/tests/ascii.rs')
-rw-r--r--library/core/tests/ascii.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/core/tests/ascii.rs b/library/core/tests/ascii.rs
index 0b975083947..3244bbc2d67 100644
--- a/library/core/tests/ascii.rs
+++ b/library/core/tests/ascii.rs
@@ -397,3 +397,14 @@ fn test_is_ascii_align_size_thoroughly() {
         }
     }
 }
+
+#[test]
+fn ascii_const() {
+    // test that the `is_ascii` methods of `char` and `u8` are usable in a const context
+
+    const CHAR_IS_ASCII: bool = 'a'.is_ascii();
+    assert!(CHAR_IS_ASCII);
+
+    const BYTE_IS_ASCII: bool = 97u8.is_ascii();
+    assert!(BYTE_IS_ASCII);
+}