delve/dwarf/line/state_machine_test.go
Derek Parker a788e03c7b Implement initial next implementation
This current implementation does not cover the following:

* Setting correct breakpoint when exiting loop
* Setting correct breakpoint when returning from function
    * All facilities are available for this, it just is not taken into
      account in the current `next` implementation.
2014-07-07 08:26:36 -05:00

34 lines
611 B
Go

package line
import (
"path/filepath"
"testing"
"github.com/derekparker/dbg/dwarf/_helper"
)
var testfile string
func init() {
testfile, _ = filepath.Abs("../../_fixtures/testnextprog")
}
func TestNextLocAfterPC(t *testing.T) {
var (
data = grabDebugLineSection("../../_fixtures/testnextprog", t)
dbl = Parse(data)
gosym = dwarfhelper.GosymData(testfile, t)
pc, _, _ = gosym.LineToPC(testfile+".go", 20)
)
f, l, _ := dbl.NextLocAfterPC(pc)
if f != testfile+".go" {
t.Fatal("File not returned correctly", f)
}
if l != 22 {
t.Fatal("Line not returned correctly", l)
}
}