about summary refs log tree commit diff
path: root/src/libregex/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-29 20:16:57 +0000
committerbors <bors@rust-lang.org>2014-10-29 20:16:57 +0000
commit77f44d4a7bf14805fda5fc41310a6aeffda30fd4 (patch)
treeaea7012d4afbf278ae64ce92cff06c3d2a7e00cc /src/libregex/test
parent4769bca1483839ff9c0ad8353c206d6ee06c50e1 (diff)
parent6ac7fc73f5acfe30c698ea4f8bfc37b30473977e (diff)
downloadrust-77f44d4a7bf14805fda5fc41310a6aeffda30fd4.tar.gz
rust-77f44d4a7bf14805fda5fc41310a6aeffda30fd4.zip
auto merge of #17894 : steveklabnik/rust/fail_to_panic, r=aturon
This in-progress PR implements https://github.com/rust-lang/rust/issues/17489.

I made the code changes in this commit, next is to go through alllllllll the documentation and fix various things.

- Rename column headings as appropriate, `# Panics` for panic conditions and `# Errors` for `Result`s.
- clean up usage of words like 'fail' in error messages

Anything else to add to the list, @aturon ? I think I should leave the actual functions with names like `slice_or_fail` alone, since you'll get to those in your conventions work?

I'm submitting just the code bits now so that we can see it separately, and I also don't want to have to keep re-building rust over and over again if I don't have to :wink: 

Listing all the bits so I can remember as I go:

- [x] compiler-rt
- [x] compiletest
- [x] doc
- [x] driver
- [x] etc
- [x] grammar
- [x] jemalloc
- [x] liballoc
- [x] libarena
- [x] libbacktrace
- [x] libcollections
- [x] libcore
- [x] libcoretest
- [x] libdebug
- [x] libflate
- [x] libfmt_macros
- [x] libfourcc
- [x] libgetopts
- [x] libglob
- [x] libgraphviz
- [x] libgreen
- [x] libhexfloat
- [x] liblibc
- [x] liblog
- [x] libnative
- [x] libnum
- [x] librand
- [x] librbml
- [x] libregex
- [x] libregex_macros
- [x] librlibc
- [x] librustc
- [x] librustc_back
- [x] librustc_llvm
- [x] librustdoc
- [x] librustrt
- [x] libsemver
- [x] libserialize
- [x] libstd
- [x] libsync
- [x] libsyntax
- [x] libterm
- [x] libtest
- [x] libtime
- [x] libunicode
- [x] liburl
- [x] libuuid
- [x] llvm
- [x] rt
- [x] test
Diffstat (limited to 'src/libregex/test')
-rw-r--r--src/libregex/test/bench.rs4
-rw-r--r--src/libregex/test/mod.rs2
-rw-r--r--src/libregex/test/tests.rs4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/libregex/test/bench.rs b/src/libregex/test/bench.rs
index be8e12b09f0..e1c24a902fa 100644
--- a/src/libregex/test/bench.rs
+++ b/src/libregex/test/bench.rs
@@ -15,7 +15,7 @@ use stdtest::Bencher;
 use regex::{Regex, NoExpand};
 
 fn bench_assert_match(b: &mut Bencher, re: Regex, text: &str) {
-    b.iter(|| if !re.is_match(text) { fail!("no match") });
+    b.iter(|| if !re.is_match(text) { panic!("no match") });
 }
 
 #[bench]
@@ -143,7 +143,7 @@ macro_rules! throughput(
         fn $name(b: &mut Bencher) {
             let text = gen_text($size);
             b.bytes = $size;
-            b.iter(|| if $regex.is_match(text.as_slice()) { fail!("match") });
+            b.iter(|| if $regex.is_match(text.as_slice()) { panic!("match") });
         }
     );
 )
diff --git a/src/libregex/test/mod.rs b/src/libregex/test/mod.rs
index 96c600b0fda..7f014b4eb68 100644
--- a/src/libregex/test/mod.rs
+++ b/src/libregex/test/mod.rs
@@ -30,7 +30,7 @@ macro_rules! regex(
     ($re:expr) => (
         match ::regex::Regex::new($re) {
             Ok(re) => re,
-            Err(err) => fail!("{}", err),
+            Err(err) => panic!("{}", err),
         }
     );
 )
diff --git a/src/libregex/test/tests.rs b/src/libregex/test/tests.rs
index 06f7db27418..52a97703042 100644
--- a/src/libregex/test/tests.rs
+++ b/src/libregex/test/tests.rs
@@ -99,7 +99,7 @@ macro_rules! noparse(
             let re = $re;
             match Regex::new(re) {
                 Err(_) => {},
-                Ok(_) => fail!("Regex '{}' should cause a parse error.", re),
+                Ok(_) => panic!("Regex '{}' should cause a parse error.", re),
             }
         }
     );
@@ -161,7 +161,7 @@ macro_rules! mat(
                 sgot = sgot[0..sexpect.len()]
             }
             if sexpect != sgot {
-                fail!("For RE '{}' against '{}', expected '{}' but got '{}'",
+                panic!("For RE '{}' against '{}', expected '{}' but got '{}'",
                       $re, text, sexpect, sgot);
             }
         }