Skip to content

Commit

Permalink
Chore: Add test for hover on variable expansion inside bash
Browse files Browse the repository at this point in the history
  • Loading branch information
idillon-sfl committed Mar 14, 2024
1 parent 3365ed2 commit d91361c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/src/__tests__/fixtures/hover.bb
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ def test ():
VAR = "${@d.getVar("DESCRIPTION")}"

d.getVar("DESCRIPTION")

do_foo() {
"${DESCRIPTION} DESCRIPTION"
}
37 changes: 37 additions & 0 deletions server/src/__tests__/hover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,43 @@ describe('on hover', () => {
expect(shouldNotShow5).toBe(null)
})

it('shows definition on hovering variable expansion inside bash region', async () => {
bitBakeDocScanner.parseBitbakeVariablesFile()
analyzer.analyze({
uri: DUMMY_URI,
document: FIXTURE_DOCUMENT.HOVER
})

const shouldShow1 = await onHoverHandler({
textDocument: {
uri: DUMMY_URI
},
position: {
line: 52,
character: 9
}
})

const shouldNotShow1 = await onHoverHandler({
textDocument: {
uri: DUMMY_URI
},
position: {
line: 52,
character: 21
}
})

expect(shouldShow1).toEqual({
contents: {
kind: 'markdown',
value: '**DESCRIPTION**\n___\n A long description for the recipe.\n\n'
}
})

expect(shouldNotShow1).toBe(null)
})

it('should show comments above the global declarations', async () => {
bitBakeDocScanner.parseYoctoTaskFile()
bitBakeDocScanner.parseBitbakeVariablesFile()
Expand Down

0 comments on commit d91361c

Please sign in to comment.