Remove undefined behavior from test; specifically, compare(NULL, XXX, 0). Thanks to Eric for the catch

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228927 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2015-02-12 15:21:20 +00:00
parent 35e462ddee
commit bdb73f1f8b

View File

@ -41,13 +41,12 @@ void test ( const CharT *s ) {
const std::experimental::basic_string_view<CharT> sv1;
String str1 = (String) sv1;
assert ( sv1.size() == 0);
assert ( sv1.size() == str1.size ());
assert ( std::char_traits<CharT>::compare ( sv1.data(), str1.data(), sv1.size()) == 0 );
#if __cplusplus >= 201103L
auto str2 = sv1.to_string(min_allocator<CharT>());
assert ( sv1.size() == str2.size ());
assert ( std::char_traits<CharT>::compare ( sv1.data(), str2.data(), sv1.size()) == 0 );
#endif
}
}