Browse Source

Changed to time.Sleep.

Steve Thielemann 3 years ago
parent
commit
777933b158
1 changed files with 6 additions and 7 deletions
  1. 6 7
      door/input_test.go

+ 6 - 7
door/input_test.go

@@ -5,7 +5,6 @@ import (
 	"fmt"
 	"io/ioutil"
 	"os"
-	"runtime"
 	"strings"
 	"testing"
 	"time"
@@ -28,7 +27,7 @@ func TestDoorInputConnection(t *testing.T) {
 	// unicode 190x43 response
 	buffer := []byte("\x1b[1;1R\x1b[2;3R\x1b[43;190R")
 	server.Write(buffer)
-	runtime.Gosched()
+	time.Sleep(time.Millisecond)
 
 	// Access Fd (File descriptor) of client for dropfile
 	var fd int = socket_to_fd(client)
@@ -109,7 +108,7 @@ func TestDoorInputConnection(t *testing.T) {
 	for send, get := range keytest {
 		buffer := []byte(send)
 		server.Write(buffer)
-		runtime.Gosched()
+		time.Sleep(time.Millisecond)
 
 		recv := make([]int, 0)
 		for {
@@ -163,7 +162,7 @@ func TestDoorInputConnection(t *testing.T) {
 	// Input test
 	buffer = []byte("1234567890\r")
 	server.Write(buffer)
-	runtime.Gosched()
+	time.Sleep(time.Millisecond)
 
 	input := d.Input(5)
 
@@ -187,7 +186,7 @@ func TestDoorInputConnection(t *testing.T) {
 
 	buffer = []byte("12345678\x08\x089\r")
 	server.Write(buffer)
-	runtime.Gosched()
+	time.Sleep(time.Millisecond)
 
 	input = d.Input(5)
 
@@ -197,7 +196,7 @@ func TestDoorInputConnection(t *testing.T) {
 
 	buffer = []byte("12\x08\x08\x08987\x00\x48654321\r")
 	server.Write(buffer)
-	runtime.Gosched()
+	time.Sleep(time.Millisecond)
 
 	input = d.Input(5)
 
@@ -228,7 +227,7 @@ func TestDoorInputConnection(t *testing.T) {
 		t.Errorf("Expected -2 (hangup), got %d", hungup)
 	}
 	client.Close()
-	runtime.Gosched()
+	time.Sleep(time.Millisecond)
 
 	blank := d.Input(5)