Skip to content

Commit

Permalink
bugfixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
treefrogframework committed Apr 14, 2024
1 parent 08230ce commit 4e2daee
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 39 deletions.
83 changes: 46 additions & 37 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ jobs:
make
- name: tests
run: |
./cpi tests/concept_add.cpp
./cpi tests/fibonacci.cpp 10
./cpi tests/if_initializer.cpp
./cpi tests/ranges.cpp
./cpi tests/unique_ptr.cpp
./cpi tests/helloworld.cpp
./cpi tests/optional.cpp
./cpi tests/sqrt.cpp 7
./cpi tests/fibonacci.cpp 10
- name: error tests
run: |
./cpi tests/error_code.cpp
continue-on-error: true

ci-ubuntu22-qt6-gcc:
runs-on: ubuntu-22.04
Expand All @@ -37,17 +46,17 @@ jobs:
make
- name: tests
run: |
./cpi concept_add.cpp
./cpi fibonacci.cpp 10
./cpi if_initializer.cpp
./cpi ranges.cpp
./cpi unique_ptr.cpp
./cpi helloworld.cpp
./cpi optional.cpp
./cpi sqrt.cpp 7
./cpi tests/concept_add.cpp
./cpi tests/fibonacci.cpp 10
./cpi tests/if_initializer.cpp
./cpi tests/ranges.cpp
./cpi tests/unique_ptr.cpp
./cpi tests/helloworld.cpp
./cpi tests/optional.cpp
./cpi tests/sqrt.cpp 7
- name: error tests
run: |
./cpi error_code.cpp
./cpi tests/error_code.cpp
continue-on-error: true

ci-ubuntu22-qt6-clang:
Expand All @@ -65,17 +74,17 @@ jobs:
make
- name: tests
run: |
./cpi concept_add.cpp
./cpi fibonacci.cpp 10
./cpi if_initializer.cpp
./cpi ranges.cpp
./cpi unique_ptr.cpp
./cpi helloworld.cpp
./cpi optional.cpp
./cpi sqrt.cpp 7
./cpi tests/concept_add.cpp
./cpi tests/fibonacci.cpp 10
./cpi tests/if_initializer.cpp
./cpi tests/ranges.cpp
./cpi tests/unique_ptr.cpp
./cpi tests/helloworld.cpp
./cpi tests/optional.cpp
./cpi tests/sqrt.cpp 7
- name: error tests
run: |
./cpi error_code.cpp
./cpi tests/error_code.cpp
continue-on-error: true

ci-ubuntu20-qt5-gcc:
Expand All @@ -92,17 +101,17 @@ jobs:
make
- name: tests
run: |
./cpi concept_add.cpp
./cpi fibonacci.cpp 10
./cpi if_initializer.cpp
./cpi ranges.cpp
./cpi unique_ptr.cpp
./cpi helloworld.cpp
./cpi optional.cpp
./cpi sqrt.cpp 7
./cpi tests/concept_add.cpp
./cpi tests/fibonacci.cpp 10
./cpi tests/if_initializer.cpp
./cpi tests/ranges.cpp
./cpi tests/unique_ptr.cpp
./cpi tests/helloworld.cpp
./cpi tests/optional.cpp
./cpi tests/sqrt.cpp 7
- name: error tests
run: |
./cpi error_code.cpp
./cpi tests/error_code.cpp
continue-on-error: true

ci-ubuntu20-qt5-clang:
Expand All @@ -120,15 +129,15 @@ jobs:
make
- name: tests
run: |
./cpi concept_add.cpp
./cpi fibonacci.cpp 10
./cpi if_initializer.cpp
./cpi ranges.cpp
./cpi unique_ptr.cpp
./cpi helloworld.cpp
./cpi optional.cpp
./cpi sqrt.cpp 7
./cpi tests/concept_add.cpp
./cpi tests/fibonacci.cpp 10
./cpi tests/if_initializer.cpp
./cpi tests/ranges.cpp
./cpi tests/unique_ptr.cpp
./cpi tests/helloworld.cpp
./cpi tests/optional.cpp
./cpi tests/sqrt.cpp 7
- name: error tests
run: |
./cpi error_code.cpp
./cpi tests/error_code.cpp
continue-on-error: true
2 changes: 1 addition & 1 deletion compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ int Compiler::compileFileAndExecute(const QString &path)
{
QFile srcFile(path);
if (!srcFile.open(QIODevice::ReadOnly)) {
print() << "no such file or directory," << path << endl;
print() << "File open error, " << path << endl;
return 1;
}

Expand Down
7 changes: 6 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static QString isSetFileOption()
QString ret;
for (int i = 1; i < QCoreApplication::arguments().length(); i++) {
auto opt = QCoreApplication::arguments()[i];
if (!opt.startsWith("-") && QFileInfo(opt).exists()) {
if (!opt.startsWith("-")) {
ret = opt;
cppsArgs = QCoreApplication::arguments().mid(i + 1);
break;
Expand Down Expand Up @@ -434,6 +434,11 @@ int main(int argv, char *argc[])
Compiler compiler;

if (!file.isEmpty()) {
if (!QFileInfo(file).exists()) {
print() << "No such file, " << file << endl;
return 1;
}

ret = compiler.compileFileAndExecute(file);
if (ret) {
compiler.printLastCompilationError();
Expand Down

0 comments on commit 4e2daee

Please sign in to comment.