Fix for compilation error of tests against std::fs from early gcc-8 versions, and some small corrections.

This commit is contained in:
Steffen Schuemann 2018-09-03 21:35:07 +02:00
parent e5659e9b9b
commit 755413efc7
3 changed files with 42 additions and 5 deletions

View File

@ -1,4 +1,5 @@
Copyright (c) 2018 Steffen Schümann <s.schuemann@pobox.com> Copyright (c) 2018i, Steffen Schümann <s.schuemann@pobox.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:

View File

@ -4,7 +4,8 @@
// //
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// //
// Copyright (c) 2018 Steffen Schümann <s.schuemann@pobox.com> // Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met: // are permitted provided that the following conditions are met:

View File

@ -1,4 +1,34 @@
#define CATCH_CONFIG_MAIN //---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//---------------------------------------------------------------------------------------
#include <algorithm> #include <algorithm>
#include <cstdio> #include <cstdio>
#include <fstream> #include <fstream>
@ -6,7 +36,6 @@
#include <iostream> #include <iostream>
#include <random> #include <random>
#include <thread> #include <thread>
#include "catch.hpp"
#ifndef WIN32 #ifndef WIN32
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -22,6 +51,9 @@ using ifstream = std::ifstream;
using ofstream = std::ofstream; using ofstream = std::ofstream;
using fstream = std::fstream; using fstream = std::fstream;
} // namespace ghc } // namespace ghc
#ifdef __GNUC__
#define GCC_VERSION (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
#endif
#else #else
#include "../filesystem.h" #include "../filesystem.h"
namespace fs = ghc::filesystem; namespace fs = ghc::filesystem;
@ -32,6 +64,9 @@ using fstream = filesystem::fstream;
} // namespace ghc } // namespace ghc
#endif #endif
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
//#define TEST_LWG_2935_BEHAVIOUR //#define TEST_LWG_2935_BEHAVIOUR
#define TEST_LWG_2937_BEHAVIOUR #define TEST_LWG_2937_BEHAVIOUR
@ -163,7 +198,7 @@ TEST_CASE("30.10.8.4.1 path constructors and destructor", "[filesystem][path][fs
CHECK("//host/foo/bar" == fs::path("//host/foo/bar")); CHECK("//host/foo/bar" == fs::path("//host/foo/bar"));
} }
#ifndef GHC_OS_WINDOWS #if !defined(GHC_OS_WINDOWS) && !(defined(GCC_VERSION) && GCC_VERSION < 80100)
std::locale loc; std::locale loc;
bool testUTF8Locale = false; bool testUTF8Locale = false;
try { try {