TEST_F(ToolsTestFileSystemWalker, ThreeDirectoriesThreeFiles_100Threads) { auto dir1 = CreateSubDirectory("dir1"); auto dir2 = CreateSubDirectory("dir1/dir2"); auto dir3 = CreateSubDirectory("dir3"); auto file1 = CreateFile({mTestDirectory + "/dir1"}, {"file_1"}); auto file2 = CreateFile({mTestDirectory + "/dir1"}, {"file_2"}); auto file3 = CreateFile({mTestDirectory + "/dir3"}, {"file_3"}); EXPECT_TRUE(FileIO::DoesDirectoryExist(dir1)); EXPECT_TRUE(FileIO::DoesDirectoryExist(dir2)); EXPECT_TRUE(FileIO::DoesDirectoryExist(dir3)); EXPECT_EQ(dir2, "/tmp/TempFileSystemWalker/dir1/dir2"); EXPECT_TRUE(FileIO::DoesFileExist(file1)); EXPECT_TRUE(FileIO::DoesFileExist(file2)); EXPECT_TRUE(FileIO::DoesFileExist(file3)); std::vector<std::future<void>> futures; for (size_t index = 0; index < 100; ++index) { futures.push_back(std::async(std::launch::async, &ToolsTestFileSystemWalker::ThreeDirectoriesThreeFiles, this)); } for(auto& result : futures) { result.get(); } }
TEST_F(ToolsTestFileSystemWalker, ThreeDirectoriesThreeFiles_SameThread){ auto dir1 = CreateSubDirectory("dir1"); auto dir2 = CreateSubDirectory("dir1/dir2"); auto dir3 = CreateSubDirectory("dir3"); CreateFile({mTestDirectory + "/dir1"}, {"file_1"}); CreateFile({mTestDirectory + "/dir1"}, {"file_2"}); CreateFile({mTestDirectory + "/dir3"}, {"file_3"}); ThreeDirectoriesThreeFiles(); }
TEST_F(ToolsTestFileSystemWalker, ThreeDirectoriesThreeFiles_TwoThreads){ auto dir1 = CreateSubDirectory("dir1"); auto dir2 = CreateSubDirectory("dir1/dir2"); auto dir3 = CreateSubDirectory("dir3"); CreateFile({mTestDirectory + "/dir1"}, {"file_1"}); CreateFile({mTestDirectory + "/dir1"}, {"file_2"}); CreateFile({mTestDirectory + "/dir3"}, {"file_3"}); auto future0 = std::async(std::launch::async, &ToolsTestFileSystemWalker::ThreeDirectoriesThreeFiles, this); ThreeDirectoriesThreeFiles(); future0.get(); }
TEST_FIXTURE(TagCacheSearchFixtureClass, ExactTags) { wxString code = wxT("<?php class ActionYou { function w() {} }"); CreateSubDirectory(wxT("src")); CreateFixtureFile(wxT("src") + wxString(wxFileName::GetPathSeparator()) + wxT("file1.php"), code); t4p::TagFinderListClass* cache = CreateTagFinderList(wxT("src")); TagCache.RegisterGlobal(cache); // empty means search all dirs std::vector<wxFileName> searchDirs; t4p::TagResultClass* result = TagCache.ExactTags(UNICODE_STRING_SIMPLE("ActionYou"), searchDirs); CHECK(result); if (!result) { return; } CHECK(result->More()); result->Next(); CHECK_UNISTR_EQUALS("ActionYou", result->Tag.Identifier); CHECK_UNISTR_EQUALS("ActionYou", result->Tag.ClassName); CHECK_EQUAL(false, result->More()); // do this now so that we dont use the inherited Session delete result; }
ExpressionCompletionMatchesFixtureClass() : FileTestFixtureClass(wxT("tag-cache")) , SqliteTestFixtureClass(t4p::ResourceSqlSchemaAsset()) , TagCache() , GlobalFile(wxT("src") + wxString(wxFileName::GetPathSeparator()) + wxT("global.php")) , File1(wxT("src") + wxString(wxFileName::GetPathSeparator()) + wxT("file1.php")) , File2(wxT("src") + wxString(wxFileName::GetPathSeparator()) + wxT("file2.php")) , GlobalCode() , Code1() , Code2() , DoDuckTyping(false) , DoFullyQualifiedMatchOnly(false) , Scope() , ParsedVariable(Scope) , SourceDirs() , VariableMatches() , TagMatches() , Error() , Search() , PhpFileExtensions() , MiscFileExtensions() { CreateSubDirectory(wxT("src")); Search.Init(TestProjectDir + wxT("src")); PhpFileExtensions.push_back(wxT("*.php")); Scope.ClassName = UNICODE_STRING_SIMPLE(""); Scope.MethodName = UNICODE_STRING_SIMPLE(""); Session1 = new soci::session(*soci::factory_sqlite3(), ":memory:"); CreateDatabase(*Session1, t4p::ResourceSqlSchemaAsset()); wxFileName srcDir; srcDir.AssignDir(TestProjectDir + wxT("src")); SourceDirs.push_back(srcDir); }
PhpFunctionCallLintTestFixtureClass() : FileTestFixtureClass(wxT("php-function-call-lint")) , SqliteTestFixtureClass(t4p::ResourceSqlSchemaAsset()) , TagCache() , PhpFileExtensions() , MiscFileExtensions() , Lint() , Results() , HasError(false) { Lint.SetVersion(pelet::PHP_53); PhpFileExtensions.push_back(wxT("*.php")); CreateSubDirectory(wxT("src")); }