Skip to content

Commit

Permalink
fixup! refactor: move path resolve to path.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Dec 5, 2023
1 parent ad2ab69 commit 7c36ed1
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions test/cctest/test_util.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "debug_utils-inl.h"
#include "env-inl.h"
#include "gtest/gtest.h"
#include "node_options.h"
#include "node_test_fixture.h"
#include "simdutf.h"
#include "util-inl.h"

Expand All @@ -16,9 +14,7 @@ using node::ToLower;
using node::UncheckedCalloc;
using node::UncheckedMalloc;

class UtilTest : public EnvironmentTestFixture {};

TEST_F(UtilTest, ListHead) {
TEST(UtilTest, ListHead) {
struct Item { node::ListNode<Item> node_; };
typedef node::ListHead<Item, &Item::node_> List;

Expand Down Expand Up @@ -72,7 +68,7 @@ TEST_F(UtilTest, ListHead) {
EXPECT_FALSE(list.begin() != list.end());
}

TEST_F(UtilTest, StringEqualNoCase) {
TEST(UtilTest, StringEqualNoCase) {
EXPECT_FALSE(StringEqualNoCase("a", "b"));
EXPECT_TRUE(StringEqualNoCase("", ""));
EXPECT_TRUE(StringEqualNoCase("equal", "equal"));
Expand All @@ -82,7 +78,7 @@ TEST_F(UtilTest, StringEqualNoCase) {
EXPECT_FALSE(StringEqualNoCase("equals", "equal"));
}

TEST_F(UtilTest, StringEqualNoCaseN) {
TEST(UtilTest, StringEqualNoCaseN) {
EXPECT_FALSE(StringEqualNoCaseN("a", "b", strlen("a")));
EXPECT_TRUE(StringEqualNoCaseN("", "", strlen("")));
EXPECT_TRUE(StringEqualNoCaseN("equal", "equal", strlen("equal")));
Expand All @@ -96,7 +92,7 @@ TEST_F(UtilTest, StringEqualNoCaseN) {
EXPECT_FALSE(StringEqualNoCaseN("abc\0abc", "abcd\0efg", strlen("abcdefgh")));
}

TEST_F(UtilTest, ToLower) {
TEST(UtilTest, ToLower) {
EXPECT_EQ('0', ToLower('0'));
EXPECT_EQ('a', ToLower('a'));
EXPECT_EQ('a', ToLower('A'));
Expand All @@ -109,28 +105,28 @@ TEST_F(UtilTest, ToLower) {
free(pointer); \
} while (0)

TEST_F(UtilTest, Malloc) {
TEST(UtilTest, Malloc) {
TEST_AND_FREE(Malloc<char>, 0);
TEST_AND_FREE(Malloc<char>, 1);
TEST_AND_FREE(Malloc, 0);
TEST_AND_FREE(Malloc, 1);
}

TEST_F(UtilTest, Calloc) {
TEST(UtilTest, Calloc) {
TEST_AND_FREE(Calloc<char>, 0);
TEST_AND_FREE(Calloc<char>, 1);
TEST_AND_FREE(Calloc, 0);
TEST_AND_FREE(Calloc, 1);
}

TEST_F(UtilTest, UncheckedMalloc) {
TEST(UtilTest, UncheckedMalloc) {
TEST_AND_FREE(UncheckedMalloc<char>, 0);
TEST_AND_FREE(UncheckedMalloc<char>, 1);
TEST_AND_FREE(UncheckedMalloc, 0);
TEST_AND_FREE(UncheckedMalloc, 1);
}

TEST_F(UtilTest, UncheckedCalloc) {
TEST(UtilTest, UncheckedCalloc) {
TEST_AND_FREE(UncheckedCalloc<char>, 0);
TEST_AND_FREE(UncheckedCalloc<char>, 1);
TEST_AND_FREE(UncheckedCalloc, 0);
Expand Down Expand Up @@ -216,7 +212,7 @@ static void MaybeStackBufferBasic() {
free(rawbuf);
}

TEST_F(UtilTest, MaybeStackBuffer) {
TEST(UtilTest, MaybeStackBuffer) {
MaybeStackBufferBasic<uint8_t>();
MaybeStackBufferBasic<uint16_t>();

Expand Down Expand Up @@ -257,7 +253,7 @@ TEST_F(UtilTest, MaybeStackBuffer) {
}
}

TEST_F(UtilTest, SPrintF) {
TEST(UtilTest, SPrintF) {
// %d, %u and %s all do the same thing. The actual C++ type is used to infer
// the right representation.
EXPECT_EQ(SPrintF("%s", false), "false");
Expand Down Expand Up @@ -304,6 +300,6 @@ TEST_F(UtilTest, SPrintF) {
EXPECT_EQ(SPrintF("%s", with_zero), with_zero);
}

TEST_F(UtilTest, DumpJavaScriptStackWithNoIsolate) {
TEST(UtilTest, DumpJavaScriptStackWithNoIsolate) {
node::DumpJavaScriptBacktrace(stderr);
}

0 comments on commit 7c36ed1

Please sign in to comment.