mirror of
https://github.com/boostorg/regex.git
synced 2025-07-29 12:07:28 +02:00
Modified wide character tests to warn not fail when no wide character support is available in the platform.
Modified Jamfiles to use centralised options. Added wide character concept check. [SVN r19318]
This commit is contained in:
84
test/Jamfile
84
test/Jamfile
@ -6,13 +6,22 @@ subproject libs/regex/test ;
|
||||
SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
|
||||
include testing.jam ;
|
||||
|
||||
include $(BOOST_ROOT)/libs/regex/base.jam ;
|
||||
|
||||
#
|
||||
# this template defines the options common to
|
||||
# all regex tests:
|
||||
#
|
||||
template test
|
||||
: <lib>../build/boost_regex # sources
|
||||
: <define>BOOST_REGEX_NO_LIB=1 # requirements
|
||||
<define>BOOST_REGEX_STATIC_LINK=1
|
||||
<threading>multi
|
||||
;
|
||||
: <template>regex-options
|
||||
<lib>../build/boost_regex # sources
|
||||
: <threading>multi
|
||||
;
|
||||
|
||||
#
|
||||
# this template defines the options common to
|
||||
# all builds of the test/regression program:
|
||||
#
|
||||
template regression
|
||||
: <template>test # sources
|
||||
regress/parse.cpp
|
||||
@ -21,45 +30,67 @@ template regression
|
||||
<lib>../../test/build/boost_prg_exec_monitor
|
||||
;
|
||||
|
||||
#
|
||||
# rule for simple regex test programs:
|
||||
#
|
||||
rule regex-test ( name : sources + : requirements * : input-files * )
|
||||
{
|
||||
return [ run $(sources)
|
||||
:
|
||||
: $(input-files)
|
||||
: $(requirements) <no-warn>parse.cpp <no-warn>regress.cpp <no-warn>tests.cpp
|
||||
: $(requirements)
|
||||
: $(name) ] ;
|
||||
}
|
||||
|
||||
#
|
||||
# this template defines the options common to
|
||||
# all regex dll tests:
|
||||
#
|
||||
template test-dll
|
||||
: <template>regex-dll-options
|
||||
<dll>../build/boost_regex # sources
|
||||
: <threading>multi
|
||||
;
|
||||
|
||||
#
|
||||
# this template defines the options common to
|
||||
# all builds of the test/regression program:
|
||||
#
|
||||
template regression-dll
|
||||
: <template>test-dll # sources
|
||||
regress/parse.cpp
|
||||
regress/regress.cpp
|
||||
regress/tests.cpp
|
||||
<lib>../../test/build/boost_prg_exec_monitor
|
||||
;
|
||||
|
||||
test-suite regex
|
||||
:
|
||||
[ regex-test regress
|
||||
[ regex-test regex_regress
|
||||
: <template>regression # sources
|
||||
: # requirements
|
||||
: regress/tests.txt # input files
|
||||
]
|
||||
|
||||
[ regex-test wregress
|
||||
[ regex-test regex_wide_regress
|
||||
: <template>regression # sources
|
||||
: <define>TEST_UNICODE=1 # requirements
|
||||
: regress/tests.txt # input files
|
||||
]
|
||||
|
||||
[ regex-test posix_api_check_c
|
||||
[ regex-test posix_api_check
|
||||
: <template>test # sources
|
||||
c_compiler_checks/posix_api_check.c
|
||||
]
|
||||
|
||||
[ regex-test wide_posix_api_check_c
|
||||
: <template>test # sources
|
||||
c_compiler_checks/wide_posix_api_check.c
|
||||
]
|
||||
[ compile <template>test c_compiler_checks/wide_posix_api_check.c ]
|
||||
|
||||
[ regex-test posix_api_check
|
||||
[ regex-test posix_api_check_cpp
|
||||
: <template>test # sources
|
||||
c_compiler_checks/posix_api_check.cpp
|
||||
]
|
||||
|
||||
[ regex-test wide_posix_api_check
|
||||
[ regex-test wide_posix_api_check_cpp
|
||||
: <template>test # sources
|
||||
c_compiler_checks/wide_posix_api_check.cpp
|
||||
]
|
||||
@ -76,7 +107,28 @@ test-suite regex
|
||||
<lib>../../test/build/boost_test_exec_monitor
|
||||
]
|
||||
|
||||
[ compile pathology/concept_check.cpp
|
||||
[ run config_info/regex_config_info.cpp <template>test
|
||||
: : : <test-info>always_show_run_output ]
|
||||
|
||||
[ run config_info/regex_config_info.cpp <template>test
|
||||
: : : <test-info>always_show_run_output
|
||||
: regex_dll_config_info ]
|
||||
|
||||
[ regex-test regex_regress_dll
|
||||
: <template>regression-dll # sources
|
||||
: # requirements
|
||||
: regress/tests.txt # input files
|
||||
]
|
||||
|
||||
[ regex-test regex_wide_regress_dll
|
||||
: <template>regression-dll # sources
|
||||
: <define>TEST_UNICODE=1 # requirements
|
||||
: regress/tests.txt # input files
|
||||
]
|
||||
|
||||
[ compile concepts/concept_check.cpp
|
||||
]
|
||||
[ compile concepts/wide_concept_check.cpp
|
||||
]
|
||||
;
|
||||
|
||||
|
@ -85,7 +85,17 @@ int main()
|
||||
}
|
||||
|
||||
#else
|
||||
# error "This library has not been configured for wide character support"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout <<
|
||||
"\n<note>\n"
|
||||
"This platform does not provide the needed wide character support for this test.\n"
|
||||
"</note>\n";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
63
test/concepts/wide_concept_check.cpp
Normal file
63
test/concepts/wide_concept_check.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2003
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/concept_archetype.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
// VC6 and VC7 can't cope with the iterator architypes,
|
||||
// don't bother testing as it doesn't work:
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
|
||||
typedef boost::bidirectional_iterator_archetype<wchar_t> iterator_type;
|
||||
boost::wregex r;
|
||||
iterator_type a, b;
|
||||
boost::detail::dummy_constructor dummy;
|
||||
boost::output_iterator_archetype<wchar_t> out(dummy);
|
||||
std::wstring s;
|
||||
boost::match_results<iterator_type> what;
|
||||
|
||||
boost::regex_match(a, b, r);
|
||||
boost::regex_match(a, b, what, r);
|
||||
boost::regex_search(a, b, r);
|
||||
boost::regex_search(a, b, what, r);
|
||||
out = boost::regex_replace(out, a, b, r, s, boost::match_default);
|
||||
s = boost::regex_replace(s, r, s, boost::match_default);
|
||||
|
||||
out = what.format(out, s, boost::format_default);
|
||||
s = what.format(s, boost::format_default);
|
||||
|
||||
boost::function_requires<
|
||||
boost::ForwardIteratorConcept<
|
||||
boost::regex_iterator<iterator_type>
|
||||
>
|
||||
>();
|
||||
// this fails with glibc++v2 :
|
||||
#if !BOOST_WORKAROUND(__GNUC__, < 3) && !BOOST_WORKAROUND(BOOST_MSVC, <1300)
|
||||
boost::function_requires<
|
||||
boost::ForwardIteratorConcept<
|
||||
boost::regex_token_iterator<iterator_type>
|
||||
>
|
||||
>();
|
||||
#endif // GCC 2.x
|
||||
#endif // MSVC 6
|
||||
#endif // BOOST_NO_WREGEX
|
||||
return 0;
|
||||
}
|
||||
|
72
test/config_info/regex_config_info.cpp
Normal file
72
test/config_info/regex_config_info.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2003
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// This program extends config_info to print out regex library
|
||||
// configuration information. We do this by redfining the main
|
||||
// provided by config_info, our real main will call it later:
|
||||
//
|
||||
#ifndef OLD_MAIN
|
||||
# define OLD_MAIN info_main
|
||||
#endif
|
||||
|
||||
#define main OLD_MAIN
|
||||
#include <libs/config/test/config_info.cpp>
|
||||
#undef main
|
||||
#ifndef NEW_MAIN
|
||||
# define NEW_MAIN main
|
||||
#endif
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
int NEW_MAIN()
|
||||
{
|
||||
OLD_MAIN();
|
||||
|
||||
print_separator();
|
||||
PRINT_MACRO(BOOST_REGEX_USER_CONFIG);
|
||||
PRINT_MACRO(BOOST_REGEX_USE_C_LOCALE);
|
||||
PRINT_MACRO(BOOST_REGEX_USE_CPP_LOCALE);
|
||||
PRINT_MACRO(BOOST_REGEX_HAS_DLL_RUNTIME);
|
||||
PRINT_MACRO(BOOST_REGEX_DYN_LINK);
|
||||
PRINT_MACRO(BOOST_REGEX_NO_LIB);
|
||||
PRINT_MACRO(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE);
|
||||
PRINT_MACRO(BOOST_REGEX_NO_W32);
|
||||
PRINT_MACRO(BOOST_REGEX_NO_BOOL);
|
||||
PRINT_MACRO(BOOST_REGEX_NO_EXTERNAL_TEMPLATES);
|
||||
PRINT_MACRO(BOOST_REGEX_NO_FWD);
|
||||
PRINT_MACRO(BOOST_REGEX_V3);
|
||||
PRINT_MACRO(BOOST_REGEX_HAS_MS_STACK_GUARD);
|
||||
PRINT_MACRO(BOOST_REGEX_RECURSIVE);
|
||||
PRINT_MACRO(BOOST_REGEX_NON_RECURSIVE);
|
||||
PRINT_MACRO(BOOST_REGEX_BLOCKSIZE);
|
||||
PRINT_MACRO(BOOST_REGEX_MAX_BLOCKS);
|
||||
PRINT_MACRO(BOOST_REGEX_MAX_CACHE_BLOCKS);
|
||||
PRINT_MACRO(BOOST_NO_WREGEX);
|
||||
PRINT_MACRO(BOOST_REGEX_NO_FILEITER);
|
||||
PRINT_MACRO(BOOST_REGEX_STATIC_LINK);
|
||||
PRINT_MACRO(BOOST_REGEX_DYN_LINK);
|
||||
PRINT_MACRO(BOOST_REGEX_DECL);
|
||||
PRINT_MACRO(BOOST_REGEX_CALL);
|
||||
PRINT_MACRO(BOOST_REGEX_CCALL);
|
||||
PRINT_MACRO(BOOST_REGEX_MAX_STATE_COUNT);
|
||||
|
||||
#if defined(BOOST_REGEX_CONFIG_INFO) && !defined(NO_RECURSE)
|
||||
print_regex_library_info();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <boost/regex.hpp>
|
||||
#include "regress.h"
|
||||
|
||||
#ifndef BOOST_REGEX_NO_TEST
|
||||
|
||||
#ifndef BOOST_RE_ALGO_INCLUDED
|
||||
#include <algorithm>
|
||||
#endif
|
||||
@ -337,6 +339,4 @@ void expand_escapes(string_type& s)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -43,6 +43,8 @@ using std::endl;
|
||||
|
||||
#include "regress.h"
|
||||
|
||||
#ifndef BOOST_REGEX_NO_TEST
|
||||
|
||||
#if defined(BOOST_MSVC) && defined(_DEBUG)
|
||||
#include <CRTDBG.H>
|
||||
#endif
|
||||
@ -284,5 +286,18 @@ void jm_debug_alloc::deallocate(void* pv, size_type n)
|
||||
delete[] p;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int cpp_main(int argc, char * argv[])
|
||||
{
|
||||
std::cout <<
|
||||
"\n<note>\n"
|
||||
"This platform does not provide the needed wide character support for this test.\n"
|
||||
"</note>\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -27,6 +27,12 @@
|
||||
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_WREGEX) && defined(TEST_UNICODE)
|
||||
# define BOOST_REGEX_NO_TEST
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_NO_TEST
|
||||
|
||||
#ifdef BOOST_RE_OLD_IOSTREAM
|
||||
#include <iostream.h>
|
||||
#else
|
||||
@ -436,6 +442,8 @@ typedef boost::basic_regex<char_t, boost::c_regex_traits<char_t>, jm_debug_alloc
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <boost/regex.hpp>
|
||||
#include "regress.h"
|
||||
|
||||
#ifndef BOOST_REGEX_NO_TEST
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(disable: 4244 4267)
|
||||
#endif
|
||||
@ -884,7 +886,7 @@ void reset_error()
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user