summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-18 17:58:22 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-18 17:58:22 +0000
commit989575394506ef2f6f9f012a19e616fa818b0b3b (patch)
treebab32224d433f3cea0247063bd7836d67c255070 /libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc
parenta861752473fb992264ecdab938e77433a2107ac6 (diff)
downloadgcc-989575394506ef2f6f9f012a19e616fa818b0b3b.tar.gz
Backport Filesystem TS from mainline
* acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS, GLIBCXX_CHECK_FILESYSTEM_DEPS): Define. * configure.ac: Use them. * configure: Regenerate. * config.h.in: Regenerate. * include/Makefile.am: Add filesystem headers. Fix order of headers. * include/Makefile.in: Regenerate. * include/bits/locale_conv.h (__do_str_codecvt, __str_codecvt_in, __str_codecvt_out, wstring_convert): Refactor to move all conversion logic to non-member functions. * include/bits/quoted_string.h (_Quoted_string, operator<<, operator>>): Move from <iomanip> to new header. * include/experimental/filesystem: New. * include/experimental/fs_dir.h: New. * include/experimental/fs_fwd.h: New. * include/experimental/fs_ops.h: New. * include/experimental/fs_path.h: New. * include/std/iomanip (_Quoted_string, operator<<, operator>>): Move to <bits/quoted_string.h>. * libstdcxx/v6/printers.py (StdExpPathPrinter): Define. * scripts/testsuite_flags.in: Add filesystem dir to ldflags. * src/Makefile.am: Add filesystem sub-dir. * src/Makefile.in: Regenerate. * src/filesystem/Makefile.am: New. * src/filesystem/Makefile.in: New. * src/filesystem/dir.cc: New. * src/filesystem/ops.cc: New. * src/filesystem/path.cc: New. * testsuite/experimental/filesystem/operations/absolute.cc: New. * testsuite/experimental/filesystem/operations/copy.cc: New. * testsuite/experimental/filesystem/operations/current_path.cc: New. * testsuite/experimental/filesystem/operations/exists.cc: New. * testsuite/experimental/filesystem/operations/file_size.cc: New. * testsuite/experimental/filesystem/operations/status.cc: New. * testsuite/experimental/filesystem/operations/temp_directory_path.cc: New. * testsuite/experimental/filesystem/path/append/path.cc: New. * testsuite/experimental/filesystem/path/assign/assign.cc: New. * testsuite/experimental/filesystem/path/assign/copy.cc: New. * testsuite/experimental/filesystem/path/compare/compare.cc: New. * testsuite/experimental/filesystem/path/compare/path.cc: New. * testsuite/experimental/filesystem/path/compare/strings.cc: New. * testsuite/experimental/filesystem/path/concat/path.cc: New. * testsuite/experimental/filesystem/path/concat/strings.cc: New. * testsuite/experimental/filesystem/path/construct/copy.cc: New. * testsuite/experimental/filesystem/path/construct/default.cc: New. * testsuite/experimental/filesystem/path/construct/locale.cc: New. * testsuite/experimental/filesystem/path/construct/range.cc: New. * testsuite/experimental/filesystem/path/decompose/extension.cc: New. * testsuite/experimental/filesystem/path/decompose/filename.cc: New. * testsuite/experimental/filesystem/path/decompose/parent_path.cc: New. * testsuite/experimental/filesystem/path/decompose/relative_path.cc: New. * testsuite/experimental/filesystem/path/decompose/root_directory.cc: New. * testsuite/experimental/filesystem/path/decompose/root_name.cc: New. * testsuite/experimental/filesystem/path/decompose/root_path.cc: New. * testsuite/experimental/filesystem/path/decompose/stem.cc: New. * testsuite/experimental/filesystem/path/generic/generic_string.cc: New. * testsuite/experimental/filesystem/path/itr/traversal.cc: New. * testsuite/experimental/filesystem/path/modifiers/clear.cc: New. * testsuite/experimental/filesystem/path/modifiers/make_preferred.cc: New. * testsuite/experimental/filesystem/path/modifiers/remove_filename.cc: New. * testsuite/experimental/filesystem/path/modifiers/ replace_extension.cc: New. * testsuite/experimental/filesystem/path/modifiers/replace_filename.cc: New. * testsuite/experimental/filesystem/path/modifiers/swap.cc: New. * testsuite/experimental/filesystem/path/nonmember/hash_value.cc: New. * testsuite/experimental/filesystem/path/query/empty.cc: New. * testsuite/experimental/filesystem/path/query/has_extension.cc: New. * testsuite/experimental/filesystem/path/query/has_filename.cc: New. * testsuite/experimental/filesystem/path/query/has_parent_path.cc: New. * testsuite/experimental/filesystem/path/query/has_relative_path.cc: New. * testsuite/experimental/filesystem/path/query/has_root_directory.cc: New. * testsuite/experimental/filesystem/path/query/has_root_name.cc: New. * testsuite/experimental/filesystem/path/query/has_root_path.cc: New. * testsuite/experimental/filesystem/path/query/has_stem.cc: New. * testsuite/experimental/filesystem/path/query/is_relative.cc: New. * testsuite/lib/dg-options.exp (dg-require-filesystem-ts): Define. * testsuite/lib/libstdc++.exp (check_v3_target_filesystem_ts): Define. * testsuite/util/testsuite_fs.h: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@226983 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc')
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc
new file mode 100644
index 00000000000..d3611b88776
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++11 -lstdc++fs" }
+// { dg-require-filesystem-ts "" }
+
+// Copyright (C) 2014-2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 8.4.9 path decomposition [path.decompose]
+
+#include <experimental/filesystem>
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_fs.h>
+
+using std::experimental::filesystem::path;
+
+void
+test01()
+{
+ VERIFY( path("/foo/bar.txt").stem() == path("bar") );
+ path p = "foo.bar.baz.tar";
+ std::vector<std::string> v;
+ for (; !p.extension().empty(); p = p.stem())
+ v.push_back(p.extension().native());
+ VERIFY( v.at(0) == ".tar" );
+ VERIFY( v.at(1) == ".baz" );
+ VERIFY( v.at(2) == ".bar" );
+
+ VERIFY( path(".hidden").stem() == path() );
+
+ VERIFY( path().stem() == path() );
+ VERIFY( path(".").stem() == path(".") );
+ VERIFY( path("..").stem() == path("..") );
+}
+
+int
+main()
+{
+ test01();
+}