From 1501339438d1526194936994b5200e8571ffeb97 Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Sun, 21 Feb 2016 15:04:06 +0100 Subject: [PATCH] SelfTest checks for out_of_range exception coming from Tbc::Text --- projects/SelfTest/TestMain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index 1713b51a..99bfd1ff 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -300,7 +300,13 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) { == "one two three\n four\n five\n six" ); } + SECTION( "Wrapping near tab doesn't extract substrings from invalid positions", "" ) { + CHECK_NOTHROW( Text( "one\ttwo", TextAttributes().setWidth( 2 ) ).toString() ); + CHECK_NOTHROW( Text( "one\ttwo", TextAttributes().setWidth( 3 ) ).toString() ); + CHECK_NOTHROW( Text( "one\ttwo", TextAttributes().setWidth( 4 ) ).toString() ); + CHECK_NOTHROW( Text( "one\ttwo", TextAttributes().setWidth( 5 ) ).toString() ); + } } using namespace Catch;