Fix the overflowing tests in run-fail.

* The error patterns had a typo.

* Our current constant evaluation would silently allow the overflow
  (filed as Issue 22531).

* The overflowing-mul test was accidentally doing addition instead of
  multiplication.
This commit is contained in:
Felix S. Klock II 2015-02-19 12:37:27 +01:00
parent e7c986105f
commit 4394720dae
3 changed files with 15 additions and 6 deletions

View file

@ -8,8 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:thread '<main>' panicked at 'arithmatic operation overflowed'
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
// (Work around constant-evaluation)
fn value() -> u8 { 200 }
fn main() {
let x = 200u8 + 200u8 + 200u8;
let _x = value() + value() + value();
}

View file

@ -8,8 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:thread '<main>' panicked at 'arithmatic operation overflowed'
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
// (Work around constant-evaluation)
fn value() -> u8 { 200 }
fn main() {
let x = 200u8 + 4u8;
let x = value() * 4;
}

View file

@ -8,8 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:thread '<main>' panicked at 'arithmatic operation overflowed'
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
// (Work around constant-evaluation)
fn value() -> u8 { 42 }
fn main() {
let x = 42u8 - 43u8;
let _x = value() - (value() + 1);
}