diff --git a/debug/debugger_test.go b/debug/debugger_test.go index bba77fdb6a..4cad4365df 100644 --- a/debug/debugger_test.go +++ b/debug/debugger_test.go @@ -1511,6 +1511,14 @@ func TestDebuggerScopeVariables(t *testing.T) { name: "Locals", namedVariables: 0, }, + "Input (not provided)": { + name: "Input (not provided)", + namedVariables: 0, + }, + "Data (not provided)": { + name: "Data (not provided)", + namedVariables: 0, + }, }, }, { @@ -1543,6 +1551,10 @@ func TestDebuggerScopeVariables(t *testing.T) { }, }, }, + "Data (not provided)": { + name: "Data (not provided)", + namedVariables: 0, + }, }, }, { @@ -1580,6 +1592,10 @@ func TestDebuggerScopeVariables(t *testing.T) { }, }, }, + "Data (not provided)": { + name: "Data (not provided)", + namedVariables: 0, + }, }, }, { @@ -1644,6 +1660,14 @@ func TestDebuggerScopeVariables(t *testing.T) { }, }, }, + "Input (not provided)": { + name: "Input (not provided)", + namedVariables: 0, + }, + "Data (not provided)": { + name: "Data (not provided)", + namedVariables: 0, + }, }, }, { @@ -1662,6 +1686,14 @@ func TestDebuggerScopeVariables(t *testing.T) { }, }, }, + "Input (not provided)": { + name: "Input (not provided)", + namedVariables: 0, + }, + "Data (not provided)": { + name: "Data (not provided)", + namedVariables: 0, + }, }, }, { @@ -1684,6 +1716,14 @@ func TestDebuggerScopeVariables(t *testing.T) { name: "Locals", namedVariables: 0, }, + "Input (not provided)": { + name: "Input (not provided)", + namedVariables: 0, + }, + "Data (not provided)": { + name: "Data (not provided)", + namedVariables: 0, + }, "Result Set": { name: "Result Set", namedVariables: 1, @@ -1739,6 +1779,14 @@ func TestDebuggerScopeVariables(t *testing.T) { name: "Locals", namedVariables: 0, }, + "Input (not provided)": { + name: "Input (not provided)", + namedVariables: 0, + }, + "Data (not provided)": { + name: "Data (not provided)", + namedVariables: 0, + }, "Virtual Cache": { name: "Virtual Cache", namedVariables: 2, @@ -1766,6 +1814,10 @@ func TestDebuggerScopeVariables(t *testing.T) { name: "Locals", namedVariables: 0, }, + "Input (not provided)": { + name: "Input (not provided)", + namedVariables: 0, + }, "Data": { name: "Data", namedVariables: 1, @@ -1859,23 +1911,27 @@ func TestDebuggerScopeVariables(t *testing.T) { if scope.Name() != expScope.name { t.Errorf("Expected scope name %s, got %s", expScope.name, scope.Name()) } + if scope.NamedVariables() != expScope.namedVariables { t.Errorf("Expected %d named variables, got %d", expScope.namedVariables, scope.NamedVariables()) } - if scope.VariablesReference() == 0 { + + if scope.NamedVariables() > 0 && scope.VariablesReference() == 0 { t.Errorf("Expected non-zero variables reference") } - vars, err := s.Variables(scope.VariablesReference()) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } + if expScope.namedVariables > 0 { + vars, err := s.Variables(scope.VariablesReference()) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } - if len(vars) != expScope.namedVariables { - t.Fatalf("Expected nuber of variables to equal named variables for scope (%d), got %d", expScope.namedVariables, len(vars)) - } + if len(vars) != expScope.namedVariables { + t.Fatalf("Expected nuber of variables to equal named variables for scope (%d), got %d", expScope.namedVariables, len(vars)) + } - assertVariables(t, s, vars, expScope.variables) + assertVariables(t, s, vars, expScope.variables) + } } }) } diff --git a/debug/thread.go b/debug/thread.go index b0884241cd..1d71760615 100644 --- a/debug/thread.go +++ b/debug/thread.go @@ -360,6 +360,12 @@ func (t *thread) scopes(stackIndex int) []Scope { variablesReference: t.inputVars(e), } scopes = append(scopes, inputScope) + } else { + inputScope := scope{ + name: "Input (not provided)", + namedVariables: 0, + } + scopes = append(scopes, inputScope) } if t.store != nil { @@ -369,6 +375,12 @@ func (t *thread) scopes(stackIndex int) []Scope { variablesReference: t.dataVars(), } scopes = append(scopes, dataScope) + } else { + dataScope := scope{ + name: "Data (not provided)", + namedVariables: 0, + } + scopes = append(scopes, dataScope) } if rs := t.stack.Result(); rs != nil {