aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5b7d81f..14e9a73 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -643,6 +643,10 @@ int initProject(int argc, const _tinydir_char_t **argv)
if(!fileOverwriteResult)
fout << "Warning: Failed to create project file: " << toFileString(fileOverwriteResult.getErrMsg()) << endl;
}
+ auto testFilePath = projectPath + TINYDIR_STRING("/tests/main.cpp");
+ Result<bool> fileOverwriteResult = fileWrite(testFilePath.c_str(), "#include <cstdio>\n\nint main(int argc, char **argv)\n{\n printf(\"hello, world!\\n\");\n return 0;\n}\n");
+ if(!fileOverwriteResult)
+ fout << "Warning: Failed to create project file: " << toFileString(fileOverwriteResult.getErrMsg()) << endl;
auto gitProjDir = projectPath + TINYDIR_STRING("/.git");
if(getFileType(gitProjDir.c_str()) != FileType::FILE_NOT_FOUND)
gitInitProject(projectPath);
@@ -735,6 +739,13 @@ int newProject(int argc, const _tinydir_char_t **argv)
exit(20);
}
}
+ auto testFilePath = projectPath + TINYDIR_STRING("/tests/main.cpp");
+ Result<bool> fileOverwriteResult = fileWrite(testFilePath.c_str(), "#include <cstdio>\n\nint main(int argc, char **argv)\n{\n printf(\"hello, world!\\n\");\n return 0;\n}\n");
+ if(!fileOverwriteResult)
+ {
+ ferr << "Failed to create project file: " << toFileString(fileOverwriteResult.getErrMsg()) << endl;
+ exit(20);
+ }
// We are ignoring git init result on purpose. If it fails, just ignore it; not important
gitInitProject(projectPath);
return 0;