Skip to content

Commit

Permalink
Fix compiler test (#31)
Browse files Browse the repository at this point in the history
* Add java version to workflow

* Update .gitignore

* Add java distribution to workflow

* Update workflow

* Rename output file for testing

* Lower version of generated .class file

* Set .class file version to appropriate value
  • Loading branch information
1001mei authored Apr 7, 2024
1 parent 4de857a commit 41d8f8c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
- run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '17'
- uses: ArtiomTr/jest-coverage-report-action@v2
with:
test-script: yarn test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ lerna-debug.log*
.env.local
.vscode/settings.json


# generated class files
*.class
4 changes: 2 additions & 2 deletions src/compiler/__tests__/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function runTest(program: string, expectedResult: string) {

const prevDir = process.cwd();
process.chdir(pathToTestDir);
execSync("java -noverify Main > output 2> err.log");
const actualResult = fs.readFileSync("./output", 'utf-8');
execSync("java -noverify Main > output.log 2> err.log");
const actualResult = fs.readFileSync("./output.log", 'utf-8');
process.chdir(prevDir);

expect(actualResult).toBe(expectedResult);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { generateCode } from "./code-generator";

const MAGIC = 0xcafebabe;
const MINOR_VERSION = 0;
const MAJOR_VERSION = 61;
const MAJOR_VERSION = 52;

export class Compiler {
private symbolTable: SymbolTable;
Expand Down

1 comment on commit 41d8f8c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

Caution

Test run failed

St.
Category Percentage Covered / Total
🟡 Statements 75.7% 5880/7767
🟡 Branches 65.58% 1932/2946
🟡 Functions 75.19% 1003/1334
🟡 Lines 75.46% 5623/7452

Test suite run failed

Failed tests: 0/1026. Failed suites: 1/52.
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:133:18)
      at node_modules/@jest/core/build/TestScheduler.js:254:19
      at node_modules/emittery/index.js:363:13
          at Array.map (<anonymous>)
      at Emittery.emit (node_modules/emittery/index.js:361:23)

Report generated by 🧪jest coverage report action from 41d8f8c

Please sign in to comment.