Move duplicated utilities to the common util folder and remove NEXT_DIR (#29)

* move things to the common library and remove next_dir

* fix for windows

* one last windows fix

* last fix for real this time

* debug listener test

* fix listener threading bug
This commit is contained in:
water111
2020-09-10 20:03:31 -04:00
committed by GitHub
parent 8cbcb36687
commit de5aa7e5e4
45 changed files with 138 additions and 351 deletions
+2 -2
View File
@@ -22,9 +22,9 @@ IF (WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# TODO - split out these declarations for platform specific includes
target_link_libraries(goalc-test cross_sockets listener mman goos util common_util runtime compiler type_system gtest)
target_link_libraries(goalc-test cross_sockets listener mman goos common_util runtime compiler type_system gtest)
ELSE()
target_link_libraries(goalc-test cross_sockets goos util common_util listener runtime compiler type_system gtest)
target_link_libraries(goalc-test cross_sockets goos common_util listener runtime compiler type_system gtest)
ENDIF()
if(CMAKE_COMPILER_IS_GNUCXX AND CODE_COVERAGE)
+1 -1
View File
@@ -5,7 +5,7 @@
TEST(FileUtil, valid_path) {
std::vector<std::string> test = {"cabbage", "banana", "apple"};
std::string sampleString = FileUtil::get_file_path(test);
std::string sampleString = file_util::get_file_path(test);
// std::cout << sampleString << std::endl;
EXPECT_TRUE(true);
+5 -5
View File
@@ -6,7 +6,7 @@
#include "gtest/gtest.h"
#include "goalc/goos/Reader.h"
#include "goalc/util/file_io.h"
#include "common/util/FileUtil.h"
using namespace goos;
@@ -316,16 +316,16 @@ TEST(GoosReader, TopLevel) {
TEST(GoosReader, FromFile) {
Reader reader;
auto result = reader.read_from_file(util::combine_path({"test", "test_reader_file0.gc"})).print();
auto result = reader.read_from_file({"test", "test_reader_file0.gc"}).print();
EXPECT_TRUE(result == "(top-level (1 2 3 4))");
}
TEST(GoosReader, TextDb) {
// very specific to this particular test file, but whatever.
Reader reader;
auto file_path = util::combine_path({"test", "test_reader_file0.gc"});
auto result = reader.read_from_file(file_path).as_pair()->cdr.as_pair()->car;
std::string expected = "text from " + util::combine_path(reader.get_source_dir(), file_path) +
auto result =
reader.read_from_file({"test", "test_reader_file0.gc"}).as_pair()->cdr.as_pair()->car;
std::string expected = "text from " + file_util::get_file_path({"test", "test_reader_file0.gc"}) +
", line: 5\n(1 2 3 4)\n";
EXPECT_EQ(expected, reader.db.get_info_for(result));
}