github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/runc/libcontainer/error_test.go (about) 1 package libcontainer 2 3 import "testing" 4 5 func TestErrorCode(t *testing.T) { 6 codes := map[ErrorCode]string{ 7 IdInUse: "Id already in use", 8 InvalidIdFormat: "Invalid format", 9 ContainerPaused: "Container paused", 10 ConfigInvalid: "Invalid configuration", 11 SystemError: "System error", 12 ContainerNotExists: "Container does not exist", 13 ContainerNotStopped: "Container is not stopped", 14 ContainerNotRunning: "Container is not running", 15 ConsoleExists: "Console exists for process", 16 ContainerNotPaused: "Container is not paused", 17 NoProcessOps: "No process operations", 18 } 19 20 for code, expected := range codes { 21 if actual := code.String(); actual != expected { 22 t.Fatalf("expected string %q but received %q", expected, actual) 23 } 24 } 25 }