@razdolbai/merls 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +64 -64
- package/dist/src/lsp/completion.js +14 -11
- package/dist/test/completion.test.js +1 -1
- package/dist/test/definition-references.test.js +1 -1
- package/dist/test/diagnostics.test.js +2 -2
- package/dist/test/document-symbol.test.js +1 -1
- package/dist/test/fixture-corpus.test.js +4 -4
- package/dist/test/hover.test.js +1 -1
- package/dist/test/lexer.test.js +4 -4
- package/dist/test/local-labels.test.js +1 -1
- package/dist/test/publish-diagnostics.test.js +1 -1
- package/dist/test/semantic-tokens.test.js +2 -1
- package/dist/test/symbols.test.js +1 -1
- package/dist/test/workspace-symbol.test.js +2 -2
- package/dist/test/workspace.test.js +2 -2
- package/package.json +1 -1
- package/src/lsp/completion.ts +15 -11
- package/test/completion.test.ts +151 -151
- package/test/definition-references.test.ts +152 -152
- package/test/diagnostics.test.ts +129 -129
- package/test/document-symbol.test.ts +131 -131
- package/test/fixture-corpus.test.ts +33 -33
- package/test/fixtures/valid/{merlin32-linkscript.asm → merlin32-linkscript.S} +16 -16
- package/test/hover.test.ts +175 -175
- package/test/lexer.test.ts +87 -87
- package/test/local-labels.test.ts +47 -47
- package/test/publish-diagnostics.test.ts +206 -206
- package/test/semantic-tokens.test.ts +128 -128
- package/test/smoke/run-smoke.ps1 +177 -177
- package/test/symbols.test.ts +41 -41
- package/test/workspace-symbol.test.ts +139 -139
- package/test/workspace.test.ts +29 -29
- /package/test/fixtures/invalid/{65816-bank-ops.asm → 65816-bank-ops.S} +0 -0
- /package/test/fixtures/invalid/{65816-long-addressing.asm → 65816-long-addressing.S} +0 -0
- /package/test/fixtures/valid/{merlin32-main-6502.asm → merlin32-main-6502.S} +0 -0
- /package/test/fixtures/valid/{smoke-test.asm → smoke-test.S} +0 -0
package/test/smoke/run-smoke.ps1
CHANGED
|
@@ -1,177 +1,177 @@
|
|
|
1
|
-
# coc.nvim smoke test for merls language server.
|
|
2
|
-
#
|
|
3
|
-
# Launches Vim in headless mode with a minimal coc.nvim configuration,
|
|
4
|
-
# opens an .
|
|
5
|
-
# publish diagnostics, then exits with 0 on success / 1 on failure.
|
|
6
|
-
#
|
|
7
|
-
# Usage: pwsh test/smoke/run-smoke.ps1
|
|
8
|
-
|
|
9
|
-
$ErrorActionPreference = "Stop"
|
|
10
|
-
|
|
11
|
-
$projectRoot = (Resolve-Path "$PSScriptRoot/../..").Path
|
|
12
|
-
$smokeDir = "$projectRoot/test/smoke"
|
|
13
|
-
$fixture = "$projectRoot/test/fixtures/valid/smoke-test.
|
|
14
|
-
$cliPath = "$projectRoot/dist/src/cli.js"
|
|
15
|
-
|
|
16
|
-
# Ensure the project is built
|
|
17
|
-
if (-not (Test-Path $cliPath)) {
|
|
18
|
-
Write-Host "Building project..."
|
|
19
|
-
Push-Location $projectRoot
|
|
20
|
-
npm run build
|
|
21
|
-
Pop-Location
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
# Create an isolated temporary directory for coc.nvim config/data
|
|
25
|
-
$tmpBase = "$projectRoot/test/smoke/tmp"
|
|
26
|
-
$configDir = "$tmpBase/config"
|
|
27
|
-
$dataDir = "$tmpBase/data"
|
|
28
|
-
|
|
29
|
-
if (Test-Path $tmpBase) { Remove-Item -Recurse -Force $tmpBase }
|
|
30
|
-
New-Item -ItemType Directory -Force -Path $configDir | Out-Null
|
|
31
|
-
New-Item -ItemType Directory -Force -Path $dataDir | Out-Null
|
|
32
|
-
|
|
33
|
-
# Write the coc-settings.json into the temporary config directory
|
|
34
|
-
$cocSettings = @{
|
|
35
|
-
languageserver = @{
|
|
36
|
-
merls = @{
|
|
37
|
-
command = "node"
|
|
38
|
-
args = @($cliPath.Replace("\", "/"), "--stdio")
|
|
39
|
-
rootPatterns = @(".git", "package.json")
|
|
40
|
-
filetypes = @("asm")
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
} | ConvertTo-Json -Depth 5
|
|
44
|
-
|
|
45
|
-
Set-Content -Path "$configDir/coc-settings.json" -Value $cocSettings
|
|
46
|
-
|
|
47
|
-
# Write a tiny Vim script that will:
|
|
48
|
-
# 1. Open the fixture file
|
|
49
|
-
# 2. Wait for coc.nvim to attach the language server
|
|
50
|
-
# 3. Check CocAction('diagnosticList') for expected diagnostics
|
|
51
|
-
# 4. Write results to a file and quit
|
|
52
|
-
$checkScript = @"
|
|
53
|
-
" Wait for coc.nvim to be ready, then run checks.
|
|
54
|
-
function! s:RunChecks(timer)
|
|
55
|
-
" Check if coc.nvim is running
|
|
56
|
-
try
|
|
57
|
-
let l:services = CocAction('services')
|
|
58
|
-
catch
|
|
59
|
-
" coc.nvim not ready yet, retry
|
|
60
|
-
call timer_start(1000, function('s:RunChecks'))
|
|
61
|
-
return
|
|
62
|
-
endtry
|
|
63
|
-
|
|
64
|
-
let l:result_file = '$($tmpBase.Replace("\", "/"))/result.txt'
|
|
65
|
-
let l:lines = []
|
|
66
|
-
|
|
67
|
-
" Check that the merls service is running
|
|
68
|
-
let l:found = 0
|
|
69
|
-
for l:svc in l:services
|
|
70
|
-
if l:svc.id =~# 'merls'
|
|
71
|
-
let l:found = 1
|
|
72
|
-
let l:state = l:svc.state
|
|
73
|
-
call add(l:lines, 'SERVICE: merls ' . l:state)
|
|
74
|
-
endif
|
|
75
|
-
endfor
|
|
76
|
-
|
|
77
|
-
if !l:found
|
|
78
|
-
call add(l:lines, 'SERVICE: merls NOT FOUND')
|
|
79
|
-
call writefile(l:lines, l:result_file)
|
|
80
|
-
qall!
|
|
81
|
-
return
|
|
82
|
-
endif
|
|
83
|
-
|
|
84
|
-
" Wait a moment for diagnostics to arrive, then collect them
|
|
85
|
-
call timer_start(2000, {-> s:CollectDiagnostics(l:lines, l:result_file)})
|
|
86
|
-
endfunction
|
|
87
|
-
|
|
88
|
-
function! s:CollectDiagnostics(lines, result_file)
|
|
89
|
-
try
|
|
90
|
-
let l:diags = CocAction('diagnosticList')
|
|
91
|
-
call add(a:lines, 'DIAGNOSTICS_COUNT: ' . len(l:diags))
|
|
92
|
-
for l:d in l:diags
|
|
93
|
-
call add(a:lines, 'DIAG: ' . l:d.severity . ' | ' . l:d.message)
|
|
94
|
-
endfor
|
|
95
|
-
catch
|
|
96
|
-
call add(a:lines, 'DIAGNOSTICS_ERROR: ' . v:exception)
|
|
97
|
-
endtry
|
|
98
|
-
|
|
99
|
-
call writefile(a:lines, a:result_file)
|
|
100
|
-
qall!
|
|
101
|
-
endfunction
|
|
102
|
-
|
|
103
|
-
" Start the check timer after a 3 second delay to let coc.nvim initialize
|
|
104
|
-
call timer_start(3000, function('s:RunChecks'))
|
|
105
|
-
"@
|
|
106
|
-
|
|
107
|
-
Set-Content -Path "$smokeDir/check.vim" -Value $checkScript
|
|
108
|
-
|
|
109
|
-
# Run Vim in headless mode
|
|
110
|
-
Write-Host "Starting Vim headless smoke test..."
|
|
111
|
-
$env:MERLS_SMOKE_CONFIG = $configDir
|
|
112
|
-
$env:MERLS_SMOKE_DATA = $dataDir
|
|
113
|
-
|
|
114
|
-
$vimArgs = @(
|
|
115
|
-
"-u", "$smokeDir/vimrc",
|
|
116
|
-
"-N", # nocompatible
|
|
117
|
-
"--not-a-term", # headless
|
|
118
|
-
"-S", "$smokeDir/check.vim",
|
|
119
|
-
$fixture
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
$vimProcess = Start-Process -FilePath "vim" -ArgumentList $vimArgs `
|
|
123
|
-
-PassThru -NoNewWindow -Wait -ErrorAction Stop
|
|
124
|
-
|
|
125
|
-
# Read results
|
|
126
|
-
$resultFile = "$tmpBase/result.txt"
|
|
127
|
-
if (-not (Test-Path $resultFile)) {
|
|
128
|
-
Write-Host "FAIL: Vim exited without writing results."
|
|
129
|
-
exit 1
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
$results = Get-Content $resultFile
|
|
133
|
-
Write-Host ""
|
|
134
|
-
Write-Host "=== Smoke test results ==="
|
|
135
|
-
$results | ForEach-Object { Write-Host " $_" }
|
|
136
|
-
Write-Host ""
|
|
137
|
-
|
|
138
|
-
# Validate
|
|
139
|
-
$passed = $true
|
|
140
|
-
|
|
141
|
-
# Check service was found and running
|
|
142
|
-
$serviceLine = $results | Where-Object { $_ -match "^SERVICE:" }
|
|
143
|
-
if ($serviceLine -match "running") {
|
|
144
|
-
Write-Host "PASS: merls language server is running in coc.nvim"
|
|
145
|
-
} else {
|
|
146
|
-
Write-Host "FAIL: merls language server not running. Got: $serviceLine"
|
|
147
|
-
$passed = $false
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
# Check diagnostics were received
|
|
151
|
-
$diagCountLine = $results | Where-Object { $_ -match "^DIAGNOSTICS_COUNT:" }
|
|
152
|
-
if ($diagCountLine) {
|
|
153
|
-
$count = [int]($diagCountLine -replace "DIAGNOSTICS_COUNT:\s*", "")
|
|
154
|
-
if ($count -gt 0) {
|
|
155
|
-
Write-Host "PASS: received $count diagnostic(s) from merls"
|
|
156
|
-
} else {
|
|
157
|
-
Write-Host "FAIL: expected at least 1 diagnostic, got 0"
|
|
158
|
-
$passed = $false
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
Write-Host "FAIL: no diagnostic count in results"
|
|
162
|
-
$passed = $false
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
# Cleanup
|
|
166
|
-
Remove-Item -Recurse -Force $tmpBase -ErrorAction SilentlyContinue
|
|
167
|
-
Remove-Item -Force "$smokeDir/check.vim" -ErrorAction SilentlyContinue
|
|
168
|
-
|
|
169
|
-
if ($passed) {
|
|
170
|
-
Write-Host ""
|
|
171
|
-
Write-Host "Smoke test PASSED."
|
|
172
|
-
exit 0
|
|
173
|
-
} else {
|
|
174
|
-
Write-Host ""
|
|
175
|
-
Write-Host "Smoke test FAILED."
|
|
176
|
-
exit 1
|
|
177
|
-
}
|
|
1
|
+
# coc.nvim smoke test for merls language server.
|
|
2
|
+
#
|
|
3
|
+
# Launches Vim in headless mode with a minimal coc.nvim configuration,
|
|
4
|
+
# opens an .S fixture file, waits for the language server to start and
|
|
5
|
+
# publish diagnostics, then exits with 0 on success / 1 on failure.
|
|
6
|
+
#
|
|
7
|
+
# Usage: pwsh test/smoke/run-smoke.ps1
|
|
8
|
+
|
|
9
|
+
$ErrorActionPreference = "Stop"
|
|
10
|
+
|
|
11
|
+
$projectRoot = (Resolve-Path "$PSScriptRoot/../..").Path
|
|
12
|
+
$smokeDir = "$projectRoot/test/smoke"
|
|
13
|
+
$fixture = "$projectRoot/test/fixtures/valid/smoke-test.S"
|
|
14
|
+
$cliPath = "$projectRoot/dist/src/cli.js"
|
|
15
|
+
|
|
16
|
+
# Ensure the project is built
|
|
17
|
+
if (-not (Test-Path $cliPath)) {
|
|
18
|
+
Write-Host "Building project..."
|
|
19
|
+
Push-Location $projectRoot
|
|
20
|
+
npm run build
|
|
21
|
+
Pop-Location
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# Create an isolated temporary directory for coc.nvim config/data
|
|
25
|
+
$tmpBase = "$projectRoot/test/smoke/tmp"
|
|
26
|
+
$configDir = "$tmpBase/config"
|
|
27
|
+
$dataDir = "$tmpBase/data"
|
|
28
|
+
|
|
29
|
+
if (Test-Path $tmpBase) { Remove-Item -Recurse -Force $tmpBase }
|
|
30
|
+
New-Item -ItemType Directory -Force -Path $configDir | Out-Null
|
|
31
|
+
New-Item -ItemType Directory -Force -Path $dataDir | Out-Null
|
|
32
|
+
|
|
33
|
+
# Write the coc-settings.json into the temporary config directory
|
|
34
|
+
$cocSettings = @{
|
|
35
|
+
languageserver = @{
|
|
36
|
+
merls = @{
|
|
37
|
+
command = "node"
|
|
38
|
+
args = @($cliPath.Replace("\", "/"), "--stdio")
|
|
39
|
+
rootPatterns = @(".git", "package.json")
|
|
40
|
+
filetypes = @("asm")
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} | ConvertTo-Json -Depth 5
|
|
44
|
+
|
|
45
|
+
Set-Content -Path "$configDir/coc-settings.json" -Value $cocSettings
|
|
46
|
+
|
|
47
|
+
# Write a tiny Vim script that will:
|
|
48
|
+
# 1. Open the fixture file
|
|
49
|
+
# 2. Wait for coc.nvim to attach the language server
|
|
50
|
+
# 3. Check CocAction('diagnosticList') for expected diagnostics
|
|
51
|
+
# 4. Write results to a file and quit
|
|
52
|
+
$checkScript = @"
|
|
53
|
+
" Wait for coc.nvim to be ready, then run checks.
|
|
54
|
+
function! s:RunChecks(timer)
|
|
55
|
+
" Check if coc.nvim is running
|
|
56
|
+
try
|
|
57
|
+
let l:services = CocAction('services')
|
|
58
|
+
catch
|
|
59
|
+
" coc.nvim not ready yet, retry
|
|
60
|
+
call timer_start(1000, function('s:RunChecks'))
|
|
61
|
+
return
|
|
62
|
+
endtry
|
|
63
|
+
|
|
64
|
+
let l:result_file = '$($tmpBase.Replace("\", "/"))/result.txt'
|
|
65
|
+
let l:lines = []
|
|
66
|
+
|
|
67
|
+
" Check that the merls service is running
|
|
68
|
+
let l:found = 0
|
|
69
|
+
for l:svc in l:services
|
|
70
|
+
if l:svc.id =~# 'merls'
|
|
71
|
+
let l:found = 1
|
|
72
|
+
let l:state = l:svc.state
|
|
73
|
+
call add(l:lines, 'SERVICE: merls ' . l:state)
|
|
74
|
+
endif
|
|
75
|
+
endfor
|
|
76
|
+
|
|
77
|
+
if !l:found
|
|
78
|
+
call add(l:lines, 'SERVICE: merls NOT FOUND')
|
|
79
|
+
call writefile(l:lines, l:result_file)
|
|
80
|
+
qall!
|
|
81
|
+
return
|
|
82
|
+
endif
|
|
83
|
+
|
|
84
|
+
" Wait a moment for diagnostics to arrive, then collect them
|
|
85
|
+
call timer_start(2000, {-> s:CollectDiagnostics(l:lines, l:result_file)})
|
|
86
|
+
endfunction
|
|
87
|
+
|
|
88
|
+
function! s:CollectDiagnostics(lines, result_file)
|
|
89
|
+
try
|
|
90
|
+
let l:diags = CocAction('diagnosticList')
|
|
91
|
+
call add(a:lines, 'DIAGNOSTICS_COUNT: ' . len(l:diags))
|
|
92
|
+
for l:d in l:diags
|
|
93
|
+
call add(a:lines, 'DIAG: ' . l:d.severity . ' | ' . l:d.message)
|
|
94
|
+
endfor
|
|
95
|
+
catch
|
|
96
|
+
call add(a:lines, 'DIAGNOSTICS_ERROR: ' . v:exception)
|
|
97
|
+
endtry
|
|
98
|
+
|
|
99
|
+
call writefile(a:lines, a:result_file)
|
|
100
|
+
qall!
|
|
101
|
+
endfunction
|
|
102
|
+
|
|
103
|
+
" Start the check timer after a 3 second delay to let coc.nvim initialize
|
|
104
|
+
call timer_start(3000, function('s:RunChecks'))
|
|
105
|
+
"@
|
|
106
|
+
|
|
107
|
+
Set-Content -Path "$smokeDir/check.vim" -Value $checkScript
|
|
108
|
+
|
|
109
|
+
# Run Vim in headless mode
|
|
110
|
+
Write-Host "Starting Vim headless smoke test..."
|
|
111
|
+
$env:MERLS_SMOKE_CONFIG = $configDir
|
|
112
|
+
$env:MERLS_SMOKE_DATA = $dataDir
|
|
113
|
+
|
|
114
|
+
$vimArgs = @(
|
|
115
|
+
"-u", "$smokeDir/vimrc",
|
|
116
|
+
"-N", # nocompatible
|
|
117
|
+
"--not-a-term", # headless
|
|
118
|
+
"-S", "$smokeDir/check.vim",
|
|
119
|
+
$fixture
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
$vimProcess = Start-Process -FilePath "vim" -ArgumentList $vimArgs `
|
|
123
|
+
-PassThru -NoNewWindow -Wait -ErrorAction Stop
|
|
124
|
+
|
|
125
|
+
# Read results
|
|
126
|
+
$resultFile = "$tmpBase/result.txt"
|
|
127
|
+
if (-not (Test-Path $resultFile)) {
|
|
128
|
+
Write-Host "FAIL: Vim exited without writing results."
|
|
129
|
+
exit 1
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
$results = Get-Content $resultFile
|
|
133
|
+
Write-Host ""
|
|
134
|
+
Write-Host "=== Smoke test results ==="
|
|
135
|
+
$results | ForEach-Object { Write-Host " $_" }
|
|
136
|
+
Write-Host ""
|
|
137
|
+
|
|
138
|
+
# Validate
|
|
139
|
+
$passed = $true
|
|
140
|
+
|
|
141
|
+
# Check service was found and running
|
|
142
|
+
$serviceLine = $results | Where-Object { $_ -match "^SERVICE:" }
|
|
143
|
+
if ($serviceLine -match "running") {
|
|
144
|
+
Write-Host "PASS: merls language server is running in coc.nvim"
|
|
145
|
+
} else {
|
|
146
|
+
Write-Host "FAIL: merls language server not running. Got: $serviceLine"
|
|
147
|
+
$passed = $false
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
# Check diagnostics were received
|
|
151
|
+
$diagCountLine = $results | Where-Object { $_ -match "^DIAGNOSTICS_COUNT:" }
|
|
152
|
+
if ($diagCountLine) {
|
|
153
|
+
$count = [int]($diagCountLine -replace "DIAGNOSTICS_COUNT:\s*", "")
|
|
154
|
+
if ($count -gt 0) {
|
|
155
|
+
Write-Host "PASS: received $count diagnostic(s) from merls"
|
|
156
|
+
} else {
|
|
157
|
+
Write-Host "FAIL: expected at least 1 diagnostic, got 0"
|
|
158
|
+
$passed = $false
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
Write-Host "FAIL: no diagnostic count in results"
|
|
162
|
+
$passed = $false
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# Cleanup
|
|
166
|
+
Remove-Item -Recurse -Force $tmpBase -ErrorAction SilentlyContinue
|
|
167
|
+
Remove-Item -Force "$smokeDir/check.vim" -ErrorAction SilentlyContinue
|
|
168
|
+
|
|
169
|
+
if ($passed) {
|
|
170
|
+
Write-Host ""
|
|
171
|
+
Write-Host "Smoke test PASSED."
|
|
172
|
+
exit 0
|
|
173
|
+
} else {
|
|
174
|
+
Write-Host ""
|
|
175
|
+
Write-Host "Smoke test FAILED."
|
|
176
|
+
exit 1
|
|
177
|
+
}
|
package/test/symbols.test.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
import { parseDocument } from "../src/asm/document";
|
|
6
|
-
import { collectSymbols } from "../src/asm/symbols";
|
|
7
|
-
|
|
8
|
-
export function runSymbolsTest(): void {
|
|
9
|
-
const fixturePath = path.resolve(
|
|
10
|
-
process.cwd(),
|
|
11
|
-
"test/fixtures/valid/merlin32-main-6502.
|
|
12
|
-
);
|
|
13
|
-
const source = fs.readFileSync(fixturePath, "utf8");
|
|
14
|
-
|
|
15
|
-
const document = parseDocument(source);
|
|
16
|
-
const symbols = collectSymbols(document);
|
|
17
|
-
|
|
18
|
-
assert.deepEqual(symbols.get("TEXT"), {
|
|
19
|
-
name: "TEXT",
|
|
20
|
-
kind: "equate",
|
|
21
|
-
line: 11
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
assert.deepEqual(symbols.get("TEST_START"), {
|
|
25
|
-
name: "TEST_START",
|
|
26
|
-
kind: "label",
|
|
27
|
-
line: 31
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
assert.deepEqual(symbols.get("dum0"), {
|
|
31
|
-
name: "dum0",
|
|
32
|
-
kind: "data",
|
|
33
|
-
line: 17
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
assert.deepEqual(symbols.get("_num1"), {
|
|
37
|
-
name: "_num1",
|
|
38
|
-
kind: "data",
|
|
39
|
-
line: 25
|
|
40
|
-
});
|
|
41
|
-
}
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
import { parseDocument } from "../src/asm/document";
|
|
6
|
+
import { collectSymbols } from "../src/asm/symbols";
|
|
7
|
+
|
|
8
|
+
export function runSymbolsTest(): void {
|
|
9
|
+
const fixturePath = path.resolve(
|
|
10
|
+
process.cwd(),
|
|
11
|
+
"test/fixtures/valid/merlin32-main-6502.S"
|
|
12
|
+
);
|
|
13
|
+
const source = fs.readFileSync(fixturePath, "utf8");
|
|
14
|
+
|
|
15
|
+
const document = parseDocument(source);
|
|
16
|
+
const symbols = collectSymbols(document);
|
|
17
|
+
|
|
18
|
+
assert.deepEqual(symbols.get("TEXT"), {
|
|
19
|
+
name: "TEXT",
|
|
20
|
+
kind: "equate",
|
|
21
|
+
line: 11
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
assert.deepEqual(symbols.get("TEST_START"), {
|
|
25
|
+
name: "TEST_START",
|
|
26
|
+
kind: "label",
|
|
27
|
+
line: 31
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
assert.deepEqual(symbols.get("dum0"), {
|
|
31
|
+
name: "dum0",
|
|
32
|
+
kind: "data",
|
|
33
|
+
line: 17
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
assert.deepEqual(symbols.get("_num1"), {
|
|
37
|
+
name: "_num1",
|
|
38
|
+
kind: "data",
|
|
39
|
+
line: 25
|
|
40
|
+
});
|
|
41
|
+
}
|