From 038fd3399983bd8e46c2bfaba03dfc35da2c3efe Mon Sep 17 00:00:00 2001 From: aarzilli Date: Wed, 3 May 2017 09:10:12 +0200 Subject: [PATCH] proc_test: line numbering changed --- pkg/proc/proc_test.go | 59 ++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/pkg/proc/proc_test.go b/pkg/proc/proc_test.go index 3b2fbdc5..4f02ecd9 100644 --- a/pkg/proc/proc_test.go +++ b/pkg/proc/proc_test.go @@ -580,13 +580,28 @@ func TestNextFunctionReturn(t *testing.T) { } func TestNextFunctionReturnDefer(t *testing.T) { - testcases := []nextTest{ - {5, 8}, - {8, 9}, - {9, 10}, - {10, 6}, - {6, 7}, - {7, 8}, + var testcases []nextTest + + ver, _ := proc.ParseVersionString(runtime.Version()) + + if ver.Major < 0 || ver.AfterOrEqual(proc.GoVersion{1, 9, -1, 0, 0, ""}) { + testcases = []nextTest{ + {5, 6}, + {6, 9}, + {9, 10}, + {10, 6}, + {6, 7}, + {7, 8}, + } + } else { + testcases = []nextTest{ + {5, 8}, + {8, 9}, + {9, 10}, + {10, 6}, + {6, 7}, + {7, 8}, + } } protest.AllowRecording(t) testseq("testnextdefer", contNext, testcases, "main.main", t) @@ -2169,14 +2184,28 @@ func TestStepCallPtr(t *testing.T) { func TestStepReturnAndPanic(t *testing.T) { // Tests that Step works correctly when returning from functions // and when a deferred function is called when panic'ing. - testseq("defercall", contStep, []nextTest{ - {17, 5}, - {5, 6}, - {6, 7}, - {7, 18}, - {18, 5}, - {5, 6}, - {6, 7}}, "", t) + ver, _ := goversion.Parse(runtime.Version()) + if ver.Major < 0 || ver.AfterOrEqual(goversion.GoVersion{1, 9, -1, 0, 0, ""}) { + testseq("defercall", contStep, []nextTest{ + {17, 5}, + {5, 6}, + {6, 7}, + {7, 17}, + {17, 18}, + {18, 5}, + {5, 6}, + {6, 7}}, "", t) + + } else { + testseq("defercall", contStep, []nextTest{ + {17, 5}, + {5, 6}, + {6, 7}, + {7, 18}, + {18, 5}, + {5, 6}, + {6, 7}}, "", t) + } } func TestStepDeferReturn(t *testing.T) {