From aaabc853e84a03f72208c0e80634bd986c3ca4e2 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sun, 19 Aug 2018 16:44:10 +0900 Subject: chore: move libdeno files to //libdeno/ --- libdeno/file_util_test.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 libdeno/file_util_test.cc (limited to 'libdeno/file_util_test.cc') diff --git a/libdeno/file_util_test.cc b/libdeno/file_util_test.cc new file mode 100644 index 000000000..3f01c8115 --- /dev/null +++ b/libdeno/file_util_test.cc @@ -0,0 +1,21 @@ +// Copyright 2018 the Deno authors. All rights reserved. MIT license. +#include "testing/gtest/include/gtest/gtest.h" + +#include "file_util.h" + +TEST(FileUtilTest, ReadFileToStringFileNotExist) { + std::string output; + EXPECT_FALSE(deno::ReadFileToString("/should_error_out.txt", &output)); +} + +TEST(FileUtilTest, Basename) { + EXPECT_EQ("foo.txt", deno::Basename("foo.txt")); + EXPECT_EQ("foo.txt", deno::Basename("/foo.txt")); + EXPECT_EQ("", deno::Basename("/")); + EXPECT_EQ("foo.txt", deno::Basename(".\\foo.txt")); + EXPECT_EQ("foo.txt", deno::Basename("/home/ryan/foo.txt")); + EXPECT_EQ("foo.txt", deno::Basename("C:\\home\\ryan\\foo.txt")); +} + +// TODO(ry) success unit test. Needs a tempfile or fixture. +// TEST(FileUtilTest, ReadFileToStringSuccess) { } -- cgit v1.2.3