test fixes

This commit is contained in:
Jorijn van der Graaf 2025-11-01 06:50:41 +01:00
commit c63f3430a5
12 changed files with 4207 additions and 118 deletions

View file

@ -32,7 +32,6 @@ int main(int argc, char* argv[]) {
}
fs::path filepath = "project.json";
std::string configuration;
std::string outputDir;
std::string command = std::string(argv[1]);
std::string argument;
if(argc > 2) {
@ -44,8 +43,6 @@ int main(int argc, char* argv[]) {
std::string arg = std::string(argv[i]);
if(arg == "-r"){
run = true;
} else if(arg == "-o"){
outputDir = argv[++i];
} else if(arg == "-p"){
filepath = fs::path(argv[++i]);
} else{
@ -64,22 +61,20 @@ int main(int argc, char* argv[]) {
Project project = Project::LoadFromJSON(projectPath);
if(command == "build") {
if(outputDir.empty()){
project.Build(argument);
} else{
project.Build(argument, fs::path(outputDir));
}
Configuration& config = project.Build(argument);
if(run){
for(Configuration& config : project.configurations) {
if(config.name == configuration) {
if(config.debug) {
system(std::format("cd {} && ./{}", (projectPath/fs::path(config.outputDir)).generic_string(), project.name).c_str());
} else {
system(std::format("cd {} && lldb -o run {}", (projectPath/fs::path(config.outputDir)).generic_string(), project.name).c_str());
}
return 0;
}
std::string binDir;
if(project.binDir.empty()) {
binDir = std::format("bin/{}", config.name);
} else {
binDir = std::format("{}/{}", project.binDir.string(), config.name);
}
if(config.debug) {
system(std::format("cd {} && ./{}", (projectPath/fs::path(binDir)).string(), project.name).c_str());
} else {
system(std::format("cd {} && lldb -o run {}", (projectPath/fs::path(binDir)).string(), project.name).c_str());
}
return 0;
}
} else if(command == "test") {
if(argument.empty()) {