mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 17:34:07 +08:00
Make it possible to run JSBigString tests
Summary: Add a target for JSBigString tests that can be run with a normal `buck test` invocation. Also fix an issue in the test when `getenv` returns null by defaulting to `/tmp`. Reviewed By: ridiculousfish Differential Revision: D14716270 fbshipit-source-id: f2eb6d3aab93c32a4b41f5786aedd04a70468d75
This commit is contained in:
committed by
Facebook Github Bot
parent
17dbf98884
commit
2387d7d255
@@ -55,3 +55,17 @@ fb_xplat_cxx_test(
|
||||
react_native_xplat_target("cxxreact:jsbigstring"),
|
||||
],
|
||||
)
|
||||
|
||||
fb_xplat_cxx_test(
|
||||
name = "jsbigstring_test",
|
||||
srcs = ["jsbigstring.cpp"],
|
||||
compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
],
|
||||
deps = [
|
||||
"fbsource//xplat/folly:molly",
|
||||
"fbsource//xplat/third-party/gmock:gtest",
|
||||
react_native_xplat_target("cxxreact:jsbigstring"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -15,7 +15,10 @@ using namespace facebook::react;
|
||||
namespace {
|
||||
int tempFileFromString(std::string contents)
|
||||
{
|
||||
std::string tmp {getenv("TMPDIR")};
|
||||
const char *tmpDir = getenv("TMPDIR");
|
||||
if (tmpDir == nullptr)
|
||||
tmpDir = "/tmp";
|
||||
std::string tmp {tmpDir};
|
||||
tmp += "/temp.XXXXXX";
|
||||
|
||||
std::vector<char> tmpBuf {tmp.begin(), tmp.end()};
|
||||
|
||||
Reference in New Issue
Block a user