libcxx

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

imbue.pass.cpp (959B)


      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, class traits = regex_traits<charT>> class basic_regex;
     15 
     16 // locale_type imbue(locale_type loc);
     17 
     18 #include <regex>
     19 #include <locale>
     20 #include <cassert>
     21 
     22 #include "test_macros.h"
     23 #include "platform_support.h" // locale name macros
     24 
     25 int main()
     26 {
     27     std::regex r;
     28     std::locale loc = r.imbue(std::locale(LOCALE_en_US_UTF_8));
     29     assert(loc.name() == "C");
     30     assert(r.getloc().name() == LOCALE_en_US_UTF_8);
     31     loc = r.imbue(std::locale("C"));
     32     assert(loc.name() == LOCALE_en_US_UTF_8);
     33     assert(r.getloc().name() == "C");
     34 }