Skip to content

Commit 4620a8e

Browse files
committed
Try running tests in CI
1 parent a596b52 commit 4620a8e

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.github/workflows/build-loreline.yml

+15
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ jobs:
5050
$GIT_TAG = $($env:GITHUB_REF).replace("refs/tags/", "")
5151
./loreline version --check-tag $GIT_TAG
5252
53+
- name: Run unit tests
54+
working-directory: .
55+
run: |
56+
./loreline test ./test
57+
5358
- name: Create zip archive
5459
working-directory: .
5560
run: |
@@ -129,6 +134,11 @@ jobs:
129134
GIT_TAG=${GITHUB_REF/refs\/tags\//}
130135
./loreline version --check-tag $GIT_TAG
131136
137+
- name: Run unit tests
138+
working-directory: .
139+
run: |
140+
./loreline test ./test
141+
132142
- name: Create zip archive
133143
run: zip --symlinks -9 'loreline-mac.zip' loreline
134144

@@ -209,6 +219,11 @@ jobs:
209219
GIT_TAG=${GITHUB_REF/refs\/tags\//}
210220
./loreline version --check-tag $GIT_TAG
211221
222+
- name: Run unit tests
223+
working-directory: .
224+
run: |
225+
./loreline test ./test
226+
212227
- name: Create zip archive
213228
run: zip --symlinks -9 'loreline-linux-${{ matrix.arch }}.zip' loreline
214229

run.n

92.8 KB
Binary file not shown.

src/loreline/cli/Cli.hx

+8
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class Cli {
5656

5757
var loadedSave:Bool = false;
5858

59+
var hasFailedTest:Bool = false;
60+
5961
function new() {
6062

6163
#if loreline_debug_interpreter
@@ -226,6 +228,10 @@ class Cli {
226228
print('');
227229
}
228230

231+
if (hasFailedTest) {
232+
Sys.exit(1);
233+
}
234+
229235
}
230236

231237
function testFile(file:String, crlf:Bool) {
@@ -264,6 +270,7 @@ class Cli {
264270
print('PASS'.green().bold() + ' - ' + file.gray() + (testCase.choices != null && testCase.choices.length > 0 ? ' ~ '.gray() + '[${testCase.choices.join(',')}]'.gray() : ''));
265271
}
266272
else {
273+
hasFailedTest = true;
267274
print('FAIL'.red().bold() + (result.error != null ? ' - ' + result.error : '') + ' - ' + file.gray() + (testCase.choices != null && testCase.choices.length > 0 ? ' ~ '.gray() + '[${testCase.choices.join(',')}]'.gray() : ''));
268275

269276
if (TestRunner.compareOutput(testCase.expectedOutput, result.actualOutput) != -1) {
@@ -318,6 +325,7 @@ class Cli {
318325
});
319326
}
320327
catch (e:Any) {
328+
hasFailedTest = true;
321329
print('FAIL'.red().bold() + ' - $e - ' + file.gray());
322330
}
323331

0 commit comments

Comments
 (0)