libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

getloc.pass.cpp (1049B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // REQUIRES: locale.en_US.UTF-8
     11 
     12 // <regex>
     13 
     14 // template <class charT> struct regex_traits;
     15 
     16 // locale_type getloc()const;
     17 
     18 #include <regex>
     19 #include <cassert>
     20 
     21 #include "test_macros.h"
     22 #include "platform_support.h" // locale name macros
     23 
     24 int main()
     25 {
     26     {
     27         std::regex_traits<char> t1;
     28         assert(t1.getloc().name() == "C");
     29         std::regex_traits<wchar_t> t2;
     30         assert(t2.getloc().name() == "C");
     31     }
     32     {
     33         std::locale::global(std::locale(LOCALE_en_US_UTF_8));
     34         std::regex_traits<char> t1;
     35         assert(t1.getloc().name() == LOCALE_en_US_UTF_8);
     36         std::regex_traits<wchar_t> t2;
     37         assert(t2.getloc().name() == LOCALE_en_US_UTF_8);
     38     }
     39 }