Commit Graph

67 Commits

Author SHA1 Message Date
Dan Albert
b4ed5ca01e Add locales to available_features for tests.
Linux has a lot of failures caused by not having support for certain
locales. Since these come out as a lot of noise in the test results,
have lit.cfg detect the presence of the various locales used in the
tests and add them to config.available_features as locale.LOCALE_NAME.

This patch also adds REQUIRES: locale.REQUIRED_LOCALE to every test that
I saw failing in this manner. We probably need to add more for all the
tests requiring en_US.UTF-8, but we can do that on an as-needed basis.

One thing that concerns me is how many tests get skipped because of
missing locales (especially in regex/). We should make a point of
splitting up any tests that test default behavior _and_ behavior under a
given locale so that we aren't losing coverage for default behavior.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214753 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 18:44:48 +00:00
Dan Albert
1757386944 Base regex code on char_class_type.
__get_classname() and __bracket_expression were assuming that
char_class_type was ctype_base::mask rather than using
regex_traits<_CharT>::char_class_type.

This change allows char_class_type to be defined to something other than
ctype_base::mask so that the implementation will still work for
platforms with an 8-bit ctype mask (such as Android and OpenBSD).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214201 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 19:23:39 +00:00
Marshall Clow
6b7e6921e2 Fix Bug 19678 - libc++ does not correctly handle the regex: '[^\0]*'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209307 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-21 16:29:50 +00:00
Marshall Clow
8d4ce30c79 LWG Issue #2271: regex_traits::lookup_classname specification unclear. libc++ already does the right thing; just update the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202904 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 22:44:34 +00:00
Marshall Clow
103af3478e Implement LWG issue 2306: match_results::reference should be value_type&, not const value_type&. This is a general move by the LWG to have the reference type of read-only containers be a non-const reference; however, there are no methods that return a non-const reference to a match_result entry, so there's no worries about getting a non-const reference to a constant object.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202214 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 01:56:31 +00:00
Marshall Clow
e0f8672e7a Implement LWG Issues #2329 and #2332 - disallow iterators into temporary regexes and regexes into temporary strings
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201717 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-19 21:21:11 +00:00
Marshall Clow
0efd9dcfa0 Fix PR18404 - 'Bug in regex_token_iterator::operator++(int) implementation'. Enhance the tests for regex_token_iterator and regex_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198878 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-09 18:25:57 +00:00
Marshall Clow
1b92188a82 Found six (nmostly) identical files named 'test_allocator.h' in the libcxx test suite. Moved one to /support, made it a superset, and removed all but one of the others, and iupdated all the includes. Left the odd one (thread/futures/test_allocator.h) for later.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@196174 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-03 00:18:10 +00:00
Howard Hinnant
8b00e6c960 Ok, 3 major changes for debug mode in one commit:
1.  I had been detecting and trapping iterator == and \!= among iterators
    in different containers as an error.  But the trapping itself is actually
    an error.
    
    Consider:
    
    #include <iostream>
    #include <vector>
    #include <algorithm>

    template <class C>
    void
    display(const C& c)
    {
        std::cout << "{";
        bool first = true;
        for (const auto& x : c)
        {
            if (\!first)
                std::cout << ", ";
            first = false;
            std::cout << x;
        }
        std::cout << "}\n";
    }

    int
    main()
    {
        typedef std::vector<int> V;
        V v1 = {1, 3, 5};
        V v2 = {2, 4, 6};
        display(v1);
        display(v2);
        V::iterator i = std::find(v1.begin(), v1.end(), 1);
        V::iterator j = std::find(v2.begin(), v2.end(), 2);
        if (*i == *j)
            i = j;    // perfectly legal
        // ...
        if (i \!= j)   // the only way to check
            v2.push_back(*i);
        display(v1);
        display(v2);
    }

    It is legal to assign an iterator from one container to another of the
    same type.  This is required to work.  One might want to test whether or
    not such an assignment had been made.  The way one performs such a check
    is using the iterator's ==, \!= operator.  This is a logical and necessary
    function and does not constitute an error.

2.  I had a header circular dependence bug when _LIBCPP_DEBUG2 is defined.
    This caused a problem in several of the libc++ tests.
    Fixed.

3.  There is a serious problem when _LIBCPP_DEBUG2=1 at the moment in that
    std::basic_string is inoperable.  std::basic_string uses __wrap_iterator
    to implement its iterators.  __wrap_iterator has been rigged up in debug
    mode to support vector.  But string hasn't been rigged up yet.  This means
    that one gets false positives when using std::string in debug mode.  I've
    upped std::string's priority in www/debug_mode.html.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187636 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-02 00:26:35 +00:00
Howard Hinnant
cd59accbf5 Bill Fisher: This patch fixes a bug where std::regex in ECMAScript mode was ignoring capture groups inside lookahead assertions.
For example, matching /(?=(a))(a)/ to "a" should yield two captures: \1 = "a", \2 = "a"

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186954 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 16:18:04 +00:00
Howard Hinnant
1e1d05121d Bill Fisher: This patch fixes an ill-formed comparison when parsing control escapes, e.g. "\cA\ca". The code will now throw an error_escape exception for invalid control sequences like "\c:" or "\c".
I've added the test cases to bad_escape.pass.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186335 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-15 18:21:11 +00:00
Howard Hinnant
e840208989 Bill Fisher: This patch fixes a less likely case where '\b' can back up into invalid memory, when driven by a regex_iterator (for case 1, see r185273 or http://llvm.org/bugs/show_bug.cgi?id=16240)
The attached test program also supplies a test for the case 1 fix in r185273.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186089 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 15:32:55 +00:00
Howard Hinnant
7670f7d1ed Bill Fisher: This patch fixes a bug where regex_iterator doesn't indicate when it's restarting in the middle of a string. This bug causes /^a/ to match in the middle of the string "aaaaaaa", during iteration.
My patch uses  to communicate when  is false.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185950 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 17:29:09 +00:00
Howard Hinnant
dbc8cf059e Bill Fisher: This patch fixes a bug where the regex parser doesn't advance the pointer after reading the third character of an octal escape (in awk mode).
That is, regex{"\141", awk} results in the regular expression /a1/ instead of just /a/.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 17:43:31 +00:00
Howard Hinnant
c1ecd97f00 Provide missing '{' in parsing extended quoted characters. This fixes http://llvm.org/bugs/show_bug.cgi?id=16135
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 20:31:05 +00:00
Howard Hinnant
e57b7c445b William Fisher: A bug in __lookahead::exec causes /(?=^)b/ to match ab. When makes a recursive call to , it passes true for the value of . This causes a beginning-of-line anchor (^) inside a lookahead assertion to match anywhere in the text. This fixes http://llvm.org/bugs/show_bug.cgi?id=11118
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185196 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 19:11:23 +00:00
Howard Hinnant
918f2a80ab Bill Fisher: Fix for failing to throw an exception in regex when parsing an invalid escape sequence. This fixes http://llvm.org/bugs/show_bug.cgi?id=16023
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185192 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 18:57:30 +00:00
Howard Hinnant
dd854b2c4e Mark some tests with XFAIL for Lion and Mountain Lion.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@181336 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-07 17:37:19 +00:00
Joerg Sonnenberger
63d8f7e341 Add explicit casts to unsigned char before calling ctype functions.
Fixes the value range on platforms with signed char.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180940 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02 19:17:48 +00:00
Howard Hinnant
9976b5511a This is a start at making the libc++ test suite friendlier to the -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177824 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-23 17:27:16 +00:00
Marshall Clow
83e2c4d877 Move common header files into a 'support' directory; make 'testit' include -I to that directory; rename 'iterators.h' to 'iterator_test.h'; remove hard-coded paths to include files from more than 350 source files
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171594 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 03:21:01 +00:00
Marshall Clow
ba1920fe4b Removed several more different 'iterators.h' files in libcxx/test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171452 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-03 02:29:29 +00:00
Howard Hinnant
0a69fa14d2 Zhang Xiongpang: Add definitions for const data members. Fixes http://llvm.org/bugs/show_bug.cgi?id=14585.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170026 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-12 21:14:28 +00:00
Howard Hinnant
c6fe8cafc3 Fix <rdar://problem/10255403> match_results::begin() is off by one
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141494 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 14:36:16 +00:00
Howard Hinnant
c0d0cbad9e Windows porting work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141003 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-03 15:23:59 +00:00
Howard Hinnant
59832523ac Fix test bugs found by David Chisnall
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 18:33:46 +00:00
David Chisnall
9e02b90405 Fix locales used in re tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 17:38:03 +00:00
Howard Hinnant
709c3d27f5 Fix failure found by David Chisnall
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140255 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 16:42:32 +00:00
Howard Hinnant
e3e3291f3a Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@137522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 21:56:02 +00:00
Howard Hinnant
31aaf55f4c N3158 Missing preconditions for default-constructed match_result objects
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 21:07:55 +00:00
Howard Hinnant
b64f8b07c1 license change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 22:09:02 +00:00
Howard Hinnant
0ce02245a9 fixing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114967 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-28 17:19:10 +00:00
Howard Hinnant
73d21a4f07 Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 23:28:19 +00:00
Howard Hinnant
bbd8086ee3 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:45:01 +00:00
Howard Hinnant
a8d7759708 [re.alg.replace]. This finishes all of <regex>. That being said, <regex> is exceptionally difficult to thoroughly test. If anyone has the ability to test this, combined with the interest to do so, now would be a good time. :-)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111333 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 00:13:08 +00:00
Howard Hinnant
262b779f1d [re.tokiter]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 20:42:03 +00:00
Howard Hinnant
a712c72499 [re.regiter]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111178 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 20:21:16 +00:00
Howard Hinnant
aa78f9cdb3 [re.alg.match]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111075 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 19:58:44 +00:00
Howard Hinnant
27405f91a8 Everything under [re.results]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 18:14:02 +00:00
Howard Hinnant
7026a17a48 Everything under [re.regex]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:11:23 +00:00
Howard Hinnant
878465043f Filling out regex tests...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 21:14:20 +00:00
Howard Hinnant
15476f345d Fixed some bugs in the ecma bracket epression regarding escaped characters, and got the awk grammar going.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109599 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 17:35:27 +00:00
Howard Hinnant
e9de5ff443 lookahead for ecma
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109548 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 22:20:32 +00:00
Howard Hinnant
856846b66f grep and egrep grammars
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109534 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 19:53:10 +00:00
Howard Hinnant
ad2a7ab9a9 continued regex development...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109512 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 17:24:17 +00:00
Howard Hinnant
17615b040d A good start on ecma regex's. Maybe even feature complete, not sure yet. Also an unrelated fix to is_constructible thanks to Daniel Krugler.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109479 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 01:25:38 +00:00
Howard Hinnant
2ade7c27f8 I believe posix extended expr is feature complete. Getting started on ecma exprs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109126 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 17:53:24 +00:00
Howard Hinnant
1371b2e56e A few more tests for posix extended alternation
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109107 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 14:12:20 +00:00
Howard Hinnant
aa69808da9 A good start on extended posix regex. Loops working. Alternation working. Also update by-chapter completeness summary.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@108548 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 19:08:36 +00:00
Howard Hinnant
639a668b4c Tests for basic posix regex templated on wchar_t
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@108435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 18:18:07 +00:00