Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "absl/flags/internal/path_util.h"
00017
00018 #include "gtest/gtest.h"
00019
00020 namespace {
00021
00022 namespace flags = absl::flags_internal;
00023
00024 TEST(FlagsPathUtilTest, TestBasename) {
00025 EXPECT_EQ(flags::Basename(""), "");
00026 EXPECT_EQ(flags::Basename("a.cc"), "a.cc");
00027 EXPECT_EQ(flags::Basename("dir/a.cc"), "a.cc");
00028 EXPECT_EQ(flags::Basename("dir1/dir2/a.cc"), "a.cc");
00029 EXPECT_EQ(flags::Basename("../dir1/dir2/a.cc"), "a.cc");
00030 EXPECT_EQ(flags::Basename("/dir1/dir2/a.cc"), "a.cc");
00031 EXPECT_EQ(flags::Basename("/dir1/dir2/../dir3/a.cc"), "a.cc");
00032 }
00033
00034
00035
00036 TEST(FlagsPathUtilTest, TestPackage) {
00037 EXPECT_EQ(flags::Package(""), "");
00038 EXPECT_EQ(flags::Package("a.cc"), "");
00039 EXPECT_EQ(flags::Package("dir/a.cc"), "dir/");
00040 EXPECT_EQ(flags::Package("dir1/dir2/a.cc"), "dir1/dir2/");
00041 EXPECT_EQ(flags::Package("../dir1/dir2/a.cc"), "../dir1/dir2/");
00042 EXPECT_EQ(flags::Package("/dir1/dir2/a.cc"), "/dir1/dir2/");
00043 EXPECT_EQ(flags::Package("/dir1/dir2/../dir3/a.cc"), "/dir1/dir2/../dir3/");
00044 }
00045
00046 }