summaryrefslogtreecommitdiff
path: root/test/libcxx/strings
diff options
context:
space:
mode:
Diffstat (limited to 'test/libcxx/strings')
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp50
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp52
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp50
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp50
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp50
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp48
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp32
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp34
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp31
-rw-r--r--test/libcxx/strings/c.strings/version_cctype.pass.cpp20
-rw-r--r--test/libcxx/strings/c.strings/version_cstring.pass.cpp20
-rw-r--r--test/libcxx/strings/c.strings/version_cuchar.pass.cpp22
-rw-r--r--test/libcxx/strings/c.strings/version_cwchar.pass.cpp20
-rw-r--r--test/libcxx/strings/c.strings/version_cwctype.pass.cpp20
-rw-r--r--test/libcxx/strings/iterators.exceptions.pass.cpp17
-rw-r--r--test/libcxx/strings/iterators.noexcept.pass.cpp12
-rw-r--r--test/libcxx/strings/version.pass.cpp20
17 files changed, 534 insertions, 14 deletions
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
new file mode 100644
index 000000000000..6c2929d7f1d3
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// Call erase(const_iterator position) with end()
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <string>
+#include <cassert>
+#include <cstdlib>
+#include <exception>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ std::string l1("123");
+ std::string::const_iterator i = l1.end();
+ l1.erase(i);
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ S l1("123");
+ S::const_iterator i = l1.end();
+ l1.erase(i);
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
new file mode 100644
index 000000000000..d20fcd4623b7
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// Call erase(const_iterator position) with iterator from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <string>
+#include <cassert>
+#include <cstdlib>
+#include <exception>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ std::string l1("123");
+ std::string l2("123");
+ std::string::const_iterator i = l2.begin();
+ l1.erase(i);
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ S l1("123");
+ S l2("123");
+ S::const_iterator i = l2.begin();
+ l1.erase(i);
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
new file mode 100644
index 000000000000..5015241ad63e
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// Call erase(const_iterator first, const_iterator last); with first iterator from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <string>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ std::string l1("123");
+ std::string l2("123");
+ std::string::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ S l1("123");
+ S l2("123");
+ S::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
new file mode 100644
index 000000000000..6a23bf88ca5c
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// Call erase(const_iterator first, const_iterator last); with second iterator from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <string>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ std::string l1("123");
+ std::string l2("123");
+ std::string::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ S l1("123");
+ S l2("123");
+ S::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
new file mode 100644
index 000000000000..a8443818aea5
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// Call erase(const_iterator first, const_iterator last); with both iterators from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <string>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ std::string l1("123");
+ std::string l2("123");
+ std::string::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ S l1("123");
+ S l2("123");
+ S::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
new file mode 100644
index 000000000000..0549e816b44c
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// Call erase(const_iterator first, const_iterator last); with a bad range
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <string>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ std::string l1("123");
+ std::string::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ S l1("123");
+ S::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
new file mode 100644
index 000000000000..8a6c3f0cf38f
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// void pop_back();
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if _LIBCPP_DEBUG >= 1
+ {
+ std::string s;
+ s.pop_back();
+ assert(false);
+ }
+#endif
+}
diff --git a/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
new file mode 100644
index 000000000000..fbb26d178997
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// iterator insert(const_iterator p, charT c);
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+
+int main()
+{
+#if _LIBCPP_DEBUG >= 1
+ {
+ typedef std::string S;
+ S s;
+ S s2;
+ s.insert(s2.begin(), '1');
+ assert(false);
+ }
+#endif
+}
diff --git a/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
new file mode 100644
index 000000000000..7ddd2b00d402
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// iterator insert(const_iterator p, size_type n, charT c);
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <string>
+#include <cassert>
+
+int main()
+{
+#if _LIBCPP_DEBUG >= 1
+ {
+ std::string s;
+ std::string s2;
+ s.insert(s2.begin(), 1, 'a');
+ assert(false);
+ }
+#endif
+}
diff --git a/test/libcxx/strings/c.strings/version_cctype.pass.cpp b/test/libcxx/strings/c.strings/version_cctype.pass.cpp
new file mode 100644
index 000000000000..e0919d9d27b0
--- /dev/null
+++ b/test/libcxx/strings/c.strings/version_cctype.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cctype>
+
+#include <cctype>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/strings/c.strings/version_cstring.pass.cpp b/test/libcxx/strings/c.strings/version_cstring.pass.cpp
new file mode 100644
index 000000000000..87e705aec4cc
--- /dev/null
+++ b/test/libcxx/strings/c.strings/version_cstring.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstring>
+
+#include <cstring>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/strings/c.strings/version_cuchar.pass.cpp b/test/libcxx/strings/c.strings/version_cuchar.pass.cpp
new file mode 100644
index 000000000000..dcfdcc37ac7e
--- /dev/null
+++ b/test/libcxx/strings/c.strings/version_cuchar.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: *
+
+// <cuchar>
+
+#include <cuchar>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/strings/c.strings/version_cwchar.pass.cpp b/test/libcxx/strings/c.strings/version_cwchar.pass.cpp
new file mode 100644
index 000000000000..72e9855c54e5
--- /dev/null
+++ b/test/libcxx/strings/c.strings/version_cwchar.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cwchar>
+
+#include <cwchar>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/strings/c.strings/version_cwctype.pass.cpp b/test/libcxx/strings/c.strings/version_cwctype.pass.cpp
new file mode 100644
index 000000000000..461482abe765
--- /dev/null
+++ b/test/libcxx/strings/c.strings/version_cwctype.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cwctype>
+
+#include <cwctype>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/strings/iterators.exceptions.pass.cpp b/test/libcxx/strings/iterators.exceptions.pass.cpp
index 591782b5dd4a..02ec921cc613 100644
--- a/test/libcxx/strings/iterators.exceptions.pass.cpp
+++ b/test/libcxx/strings/iterators.exceptions.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-
+// XFAIL: libcpp-no-exceptions
// <iterator>
// __libcpp_is_trivial_iterator<Tp>
@@ -23,6 +23,7 @@
#include <vector>
#include <initializer_list>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
@@ -30,17 +31,17 @@ int main()
// basic tests
static_assert(( std::__libcpp_string_gets_noexcept_iterator<char *>::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<const char *>::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<const char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
-
+
// iterators in the libc++ test suite
static_assert((!std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value), "");
static_assert((!std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value), "");
@@ -48,13 +49,13 @@ int main()
static_assert((!std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value), "");
static_assert((!std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value), "");
static_assert((!std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value), "");
-
-#if __has_feature(cxx_noexcept)
+
+#if TEST_STD_VER >= 11
static_assert(( std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
#else
static_assert((!std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
#endif
-
+
//
// iterators from libc++'s containers
//
diff --git a/test/libcxx/strings/iterators.noexcept.pass.cpp b/test/libcxx/strings/iterators.noexcept.pass.cpp
index f39a4deac735..283cf0897cca 100644
--- a/test/libcxx/strings/iterators.noexcept.pass.cpp
+++ b/test/libcxx/strings/iterators.noexcept.pass.cpp
@@ -34,17 +34,17 @@ int main()
// basic tests
static_assert(( std::__libcpp_string_gets_noexcept_iterator<char *>::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<const char *>::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<const char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
-
+
// iterators in the libc++ test suite
static_assert(( std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value), "");
@@ -52,9 +52,9 @@ int main()
static_assert(( std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
-
+
//
// iterators from libc++'s containers
//
diff --git a/test/libcxx/strings/version.pass.cpp b/test/libcxx/strings/version.pass.cpp
new file mode 100644
index 000000000000..0c79c1af2ce8
--- /dev/null
+++ b/test/libcxx/strings/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+#include <string>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}