about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/std/src/io/error/tests.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/std/src/io/error/tests.rs b/library/std/src/io/error/tests.rs
index eb051c33f09..5098a46313d 100644
--- a/library/std/src/io/error/tests.rs
+++ b/library/std/src/io/error/tests.rs
@@ -57,3 +57,13 @@ fn test_downcasting() {
     let extracted = err.into_inner().unwrap();
     extracted.downcast::<TestError>().unwrap();
 }
+
+#[test]
+fn test_const() {
+    const E: Error = Error::new_const(ErrorKind::NotFound, &"hello");
+
+    assert_eq!(E.kind(), ErrorKind::NotFound);
+    assert_eq!(E.to_string(), "hello");
+    assert!(format!("{:?}", E).contains("\"hello\""));
+    assert!(format!("{:?}", E).contains("NotFound"));
+}