libcxx

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

clear.pass.cpp (935B)


      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 // UNSUPPORTED: c++98, c++03
     11 
     12 // <filesystem>
     13 
     14 // class path
     15 
     16 // void clear() noexcept
     17 
     18 #include "filesystem_include.hpp"
     19 #include <type_traits>
     20 #include <cassert>
     21 
     22 #include "test_macros.h"
     23 #include "test_iterators.h"
     24 #include "count_new.hpp"
     25 #include "filesystem_test_helper.hpp"
     26 
     27 
     28 int main() {
     29   using namespace fs;
     30   {
     31     path p;
     32     ASSERT_NOEXCEPT(p.clear());
     33     ASSERT_SAME_TYPE(void, decltype(p.clear()));
     34     p.clear();
     35     assert(p.empty());
     36   }
     37   {
     38     const path p("/foo/bar/baz");
     39     path p2(p);
     40     assert(p == p2);
     41     p2.clear();
     42     assert(p2.empty());
     43   }
     44 }