Add String c_str test

This commit is contained in:
David Tolnay 2020-12-18 12:54:47 -08:00
parent cca2e616e0
commit 8bc83389f1
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -716,6 +716,12 @@ extern "C" const char *cxx_run_test() noexcept {
ASSERT((second.*cmp)(sec) == second_sec);
}
rust::String cstring = "test";
ASSERT(cstring.length() == 4);
ASSERT(strncmp(cstring.data(), "test", 4) == 0);
ASSERT(strncmp(cstring.c_str(), "test", 5) == 0);
ASSERT(cstring.length() == 4);
cxx_test_suite_set_correct();
return nullptr;
}