X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4d648ebbbe5705878080b9cbf1ca61497323c592..c085e4288adde7c5593a5358a349fc16b5885df1:/src/xbt/xbt_str_test.cpp diff --git a/src/xbt/xbt_str_test.cpp b/src/xbt/xbt_str_test.cpp index 48fe51b93f..ec659e4c4d 100644 --- a/src/xbt/xbt_str_test.cpp +++ b/src/xbt/xbt_str_test.cpp @@ -1,6 +1,6 @@ /* xbt_str.cpp - various helping functions to deal with strings */ -/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -29,15 +29,13 @@ void test_split_quoted(const std::string& name, const char* input, const std::ve template void test_parse_error(F function, const std::string& name, const char* str) { INFO(name); - REQUIRE_THROWS_MATCHES(function(str, "Parse error"), xbt_ex, - Catch::Matchers::Predicate([](xbt_ex const& e) { return e.category == arg_error; }, - "category arg_error")); + REQUIRE_THROWS_AS(function(str, "Parse error"), std::invalid_argument); } template void test_parse_ok(F function, const std::string& name, const char* str, T value) { INFO(name); - T variable = static_cast(-9999); + T variable; REQUIRE_NOTHROW(variable = function(str, "Parse error")); REQUIRE(variable == value); /* Fail to parse str */ } @@ -45,7 +43,6 @@ template void test_parse_ok(F function, const std::stri TEST_CASE("xbt::str: String Handling", "xbt_str") { - SECTION("Test the function xbt_str_split_quoted") { test_split_quoted("Empty", "", {}); @@ -53,8 +50,8 @@ TEST_CASE("xbt::str: String Handling", "xbt_str") test_split_quoted("Useless backslashes", "\\t\\o\\t\\o \\t\\u\\t\\u", {"toto", "tutu"}); test_split_quoted("Protected space", "toto\\ tutu", {"toto tutu"}); test_split_quoted("Several spaces", "toto tutu", {"toto", "tutu"}); - test_split_quoted("LTriming", " toto tatu", {"toto", "tatu"}); - test_split_quoted("Triming", " toto tutu ", {"toto", "tutu"}); + test_split_quoted("LTrimming", " toto tatu", {"toto", "tatu"}); + test_split_quoted("Trimming", " toto tutu ", {"toto", "tutu"}); test_split_quoted("Single quotes", "'toto tutu' tata", {"toto tutu", "tata"}); test_split_quoted("Double quotes", "\"toto tutu\" tata", {"toto tutu", "tata"}); test_split_quoted("Mixed quotes", "\"toto' 'tutu\" tata", {"toto' 'tutu", "tata"});