Skip to content

Commit

Permalink
Add func call as reference
Browse files Browse the repository at this point in the history
Also remove wildcard resolving for external SRC
  • Loading branch information
szapp committed May 13, 2024
1 parent 5e0471a commit f3f8c09
Show file tree
Hide file tree
Showing 8 changed files with 421 additions and 2,910 deletions.
26 changes: 3 additions & 23 deletions __tests__/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import fs from 'fs'
import tcp from 'true-case-path'
import * as io from '@actions/io'
import * as tc from '@actions/tool-cache'
import * as glob from '@actions/glob'
import { posix } from 'path'
import os from 'os'

Expand Down Expand Up @@ -278,28 +277,6 @@ describe('Parser', () => {
expect(fsReadFileSyncMock).toHaveBeenCalledWith('/path/to/file.src', 'ascii')
expect(fsReadFileSyncMock).toHaveReturnedWith('some/path/*\n')
})

it('should resolve wildcards when for excluded sources', async () => {
const patchName = 'test'
const filepath = 'path/to/file.src'
const parser = new Parser(patchName, filepath)

trueCasePathSyncMock.mockImplementation((path) => String(path))
fsReadFileSyncMock.mockReturnValue('some/path/*\n')
jest.spyOn(posix, 'join')
jest.spyOn(glob, 'create').mockResolvedValue({ glob: async () => ['some/path/glob.ext'] } as glob.Globber)

await parser['parseSrc'](filepath, false, true)

expect(posix.join).toHaveBeenCalledWith('path/to', 'some/path/*')
expect(trueCasePathSyncMock).toHaveBeenCalledWith(filepath)
expect(fsReadFileSyncMock).toHaveBeenCalledWith(filepath, 'ascii')
expect(glob.create).toHaveBeenCalledWith('path/to/some/path/*')
expect(posix.join).toHaveBeenCalledWith('path/to', 'some/path/glob.ext')
expect(parser.filelist).toEqual([])
expect(parser.symbolTable).toEqual([])
expect(parser.referenceTable).toEqual([])
})
})

describe('parseD', () => {
Expand Down Expand Up @@ -436,6 +413,7 @@ func void Symbol11(var int Symbol12, var string Symbol13, var Symbol5 Symbol14)
Symbol4[0] = 0; // Assignment
var Symbol5 Symbol21; // Indentifier declaration
Symbol21.Symbol6 = 0; // Member assignment
Symbol11(Symbol15); // Function call (syntactically incorrect)
};
`
parser['parseStr'](input, relPath)
Expand Down Expand Up @@ -488,6 +466,8 @@ func void Symbol11(var int Symbol12, var string Symbol13, var Symbol5 Symbol14)
{ name: 'SYMBOL11.SYMBOL3', file: 'file.d', line: 29 },
{ name: 'SYMBOL11.SYMBOL4', file: 'file.d', line: 30 },
{ name: 'SYMBOL11.SYMBOL21.SYMBOL6', file: 'file.d', line: 32 },
{ name: 'Symbol11', file: 'file.d', line: 33 },
{ name: 'SYMBOL11.SYMBOL15', file: 'file.d', line: 33 },
])
})
})
Expand Down
2,631 changes: 133 additions & 2,498 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

36 changes: 1 addition & 35 deletions dist/licenses.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f3f8c09

Please sign in to comment.