mirror of
https://github.com/zellyn/go6502.git
synced 2024-11-19 03:04:46 +00:00
27 lines
610 B
Go
27 lines
610 B
Go
package asm
|
|
|
|
import "testing"
|
|
|
|
func TestSymbolRE(t *testing.T) {
|
|
tests := []struct {
|
|
line string
|
|
label string
|
|
address string
|
|
}{
|
|
{"SHAPEL EQU $1A POINTER TO", "SHAPEL", "1A"},
|
|
}
|
|
|
|
for i, tt := range tests {
|
|
groups := symRe.FindStringSubmatch(tt.line)
|
|
if groups == nil {
|
|
t.Errorf(`%d. Unable to parse '%s'`, i, tt.line)
|
|
}
|
|
if groups[1] != tt.label {
|
|
t.Errorf(`%d. want label='%s'; got '%s' for line: '%s'`, i, tt.label, groups[1], tt.line)
|
|
}
|
|
if groups[2] != tt.address {
|
|
t.Errorf(`%d. want address='%s'; got '%s' for line: '%s'`, i, tt.address, groups[2], tt.line)
|
|
}
|
|
}
|
|
}
|