From d223aa6779d9f667bc041cf0ddd9f123c071034d Mon Sep 17 00:00:00 2001 From: jameslahm Date: Mon, 30 May 2022 10:03:57 +0800 Subject: [PATCH] [test] Move cctest/test-traced-value to unittests/tracing/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... traced-value-unittest. Bug: v8:12781 Change-Id: I0da3b38c12a1c1f39e47ddde9b266ff0249715bb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3675897 Reviewed-by: Leszek Swirski Commit-Queue: 王澳 Cr-Commit-Position: refs/heads/main@{#80795} --- test/cctest/BUILD.gn | 1 - test/unittests/BUILD.gn | 1 + .../tracing/traced-value-unittest.cc} | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) rename test/{cctest/test-traced-value.cc => unittests/tracing/traced-value-unittest.cc} (92%) diff --git a/test/cctest/BUILD.gn b/test/cctest/BUILD.gn index c62b836d9d..acf4311753 100644 --- a/test/cctest/BUILD.gn +++ b/test/cctest/BUILD.gn @@ -238,7 +238,6 @@ v8_source_set("cctest_sources") { "test-thread-termination.cc", "test-threads.cc", "test-trace-event.cc", - "test-traced-value.cc", "test-transitions.cc", "test-transitions.h", "test-typedarrays.cc", diff --git a/test/unittests/BUILD.gn b/test/unittests/BUILD.gn index d9fc5272bd..33375d06c8 100644 --- a/test/unittests/BUILD.gn +++ b/test/unittests/BUILD.gn @@ -438,6 +438,7 @@ v8_source_set("unittests_sources") { "torque/ls-server-data-unittest.cc", "torque/torque-unittest.cc", "torque/torque-utils-unittest.cc", + "tracing/traced-value-unittest.cc", "utils/allocation-unittest.cc", "utils/bit-vector-unittest.cc", "utils/detachable-vector-unittest.cc", diff --git a/test/cctest/test-traced-value.cc b/test/unittests/tracing/traced-value-unittest.cc similarity index 92% rename from test/cctest/test-traced-value.cc rename to test/unittests/tracing/traced-value-unittest.cc index 7ad8c43809..f17c7434db 100644 --- a/test/cctest/test-traced-value.cc +++ b/test/unittests/tracing/traced-value-unittest.cc @@ -3,11 +3,14 @@ // found in the LICENSE file. #include "src/tracing/traced-value.h" -#include "test/cctest/cctest.h" + +#include "test/unittests/test-utils.h" +#include "testing/gtest/include/gtest/gtest.h" using v8::tracing::TracedValue; +using TracedValueTest = v8::TestWithIsolate; -TEST(FlatDictionary) { +TEST_F(TracedValueTest, FlatDictionary) { auto value = TracedValue::Create(); value->SetInteger("int", 2014); value->SetDouble("double", 0.0); @@ -21,7 +24,7 @@ TEST(FlatDictionary) { json); } -TEST(NoDotPathExpansion) { +TEST_F(TracedValueTest, NoDotPathExpansion) { auto value = TracedValue::Create(); value->SetInteger("in.t", 2014); value->SetDouble("doub.le", -20.25); @@ -35,7 +38,7 @@ TEST(NoDotPathExpansion) { json); } -TEST(Hierarchy) { +TEST_F(TracedValueTest, Hierarchy) { auto value = TracedValue::Create(); value->SetInteger("i0", 2014); value->BeginDictionary("dict1"); @@ -75,7 +78,7 @@ TEST(Hierarchy) { json); } -TEST(Nesting) { +TEST_F(TracedValueTest, Nesting) { auto value = TracedValue::Create(); auto v0 = TracedValue::Create(); auto v2 = TracedValue::Create(); @@ -88,7 +91,7 @@ TEST(Nesting) { CHECK_EQ("{\"v2\":{\"v0\":{\"s1\":\"Hello World!\"}}}", json); } -TEST(LongStrings) { +TEST_F(TracedValueTest, LongStrings) { std::string long_string = "supercalifragilisticexpialidocious"; std::string long_string2 = "0123456789012345678901234567890123456789"; char long_string3[4096]; @@ -114,7 +117,7 @@ TEST(LongStrings) { json); } -TEST(Escaping) { +TEST_F(TracedValueTest, Escaping) { const char* string1 = "abc\"\'\\\\x\"y\'z\n\x09\x17"; std::string chars127; for (int i = 1; i <= 127; ++i) { @@ -137,7 +140,7 @@ TEST(Escaping) { CHECK_EQ(expected, json); } -TEST(Utf8) { +TEST_F(TracedValueTest, Utf8) { const char* string1 = "Люблю тебя, Петра творенье"; const char* string2 = "☀\u2600\u26FF"; auto value = TracedValue::Create();