File: terminal_test.go

package info (click to toggle)
delve 1.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,136 kB
  • sloc: ansic: 111,947; sh: 194; asm: 147; makefile: 43; python: 23
file content (25 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package terminal

import (
	"errors"
	"net/rpc"
	"testing"
)

func TestIsErrProcessExited(t *testing.T) {
	tests := []struct {
		name   string
		err    error
		result bool
	}{
		{"empty error", errors.New(""), false},
		{"non-ServerError", errors.New("Process 33122 has exited with status 0"), false},
		{"ServerError with zero status", rpc.ServerError("Process 33122 has exited with status 0"), true},
		{"ServerError with non-zero status", rpc.ServerError("Process 2 has exited with status 25"), true},
	}
	for _, test := range tests {
		if isErrProcessExited(test.err) != test.result {
			t.Error(test.name)
		}
	}
}