From 4394720dae12c119a9b1aed492b1b24ee089d808 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 19 Feb 2015 12:37:27 +0100 Subject: [PATCH] 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. --- src/test/run-fail/overflowing-add.rs | 7 +++++-- src/test/run-fail/overflowing-mul.rs | 7 +++++-- src/test/run-fail/overflowing-sub.rs | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/test/run-fail/overflowing-add.rs b/src/test/run-fail/overflowing-add.rs index c3e41110d20..34a03e5f008 100644 --- a/src/test/run-fail/overflowing-add.rs +++ b/src/test/run-fail/overflowing-add.rs @@ -8,8 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:thread '
' panicked at 'arithmatic operation overflowed' +// error-pattern:thread '
' 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(); } diff --git a/src/test/run-fail/overflowing-mul.rs b/src/test/run-fail/overflowing-mul.rs index bf7a9d07586..b18d99cd232 100644 --- a/src/test/run-fail/overflowing-mul.rs +++ b/src/test/run-fail/overflowing-mul.rs @@ -8,8 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:thread '
' panicked at 'arithmatic operation overflowed' +// error-pattern:thread '
' panicked at 'arithmetic operation overflowed' + +// (Work around constant-evaluation) +fn value() -> u8 { 200 } fn main() { - let x = 200u8 + 4u8; + let x = value() * 4; } diff --git a/src/test/run-fail/overflowing-sub.rs b/src/test/run-fail/overflowing-sub.rs index 961b36d322c..ee32291eca6 100644 --- a/src/test/run-fail/overflowing-sub.rs +++ b/src/test/run-fail/overflowing-sub.rs @@ -8,8 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:thread '
' panicked at 'arithmatic operation overflowed' +// error-pattern:thread '
' panicked at 'arithmetic operation overflowed' + +// (Work around constant-evaluation) +fn value() -> u8 { 42 } fn main() { - let x = 42u8 - 43u8; + let _x = value() - (value() + 1); }