about summary refs log tree commit diff
path: root/src/test/run-pass/iter-step-overflow-debug.rs
diff options
context:
space:
mode:
authorMatthew Piziak <matthew.piziak@gmail.com>2016-10-30 12:04:57 -0400
committerMatthew Piziak <matthew.piziak@gmail.com>2016-10-30 12:04:57 -0400
commitdd6e8c5f186a31ca6b714c37fd7690a83517080b (patch)
treecc4a097650ed2b18b3aad48e42f4ffb6175db4ac /src/test/run-pass/iter-step-overflow-debug.rs
parent2b4c778d9acd50a07bd5a7c28e5c8066d8191cca (diff)
downloadrust-dd6e8c5f186a31ca6b714c37fd7690a83517080b.tar.gz
rust-dd6e8c5f186a31ca6b714c37fd7690a83517080b.zip
move overflow tests from rust-fail to run-pass
Diffstat (limited to 'src/test/run-pass/iter-step-overflow-debug.rs')
-rw-r--r--src/test/run-pass/iter-step-overflow-debug.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/run-pass/iter-step-overflow-debug.rs b/src/test/run-pass/iter-step-overflow-debug.rs
new file mode 100644
index 00000000000..85f7186508f
--- /dev/null
+++ b/src/test/run-pass/iter-step-overflow-debug.rs
@@ -0,0 +1,27 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C debug_assertions=yes
+
+use std::panic;
+
+fn main() {
+    let r = panic::catch_unwind(|| {
+        let mut it = u8::max_value()..;
+        it.next().unwrap();
+    });
+    assert!(r.is_err());
+
+    let r = panic::catch_unwind(|| {
+        let mut it = i8::max_value()..;
+        it.next().unwrap();
+    });
+    assert!(r.is_err());
+}