xormplus 7 éve
szülő
commit
95c6519a6c
1 módosított fájl, 8 hozzáadás és 0 törlés
  1. 8 0
      context_test.go

+ 8 - 0
context_test.go

@@ -7,7 +7,9 @@
 package xorm
 package xorm
 
 
 import (
 import (
+	"context"
 	"testing"
 	"testing"
+	"time"
 
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/assert"
 )
 )
@@ -15,6 +17,12 @@ import (
 func TestPingContext(t *testing.T) {
 func TestPingContext(t *testing.T) {
 	assert.NoError(t, prepareEngine())
 	assert.NoError(t, prepareEngine())
 
 
+	ctx, canceled := context.WithTimeout(context.Background(), 10*time.Second)
+	defer canceled()
+
+	err := testEngine.(*Engine).PingContext(ctx)
+	assert.NoError(t, err)
+
 	// TODO: Since EngineInterface should be compitable with old Go version, PingContext is not supported.
 	// TODO: Since EngineInterface should be compitable with old Go version, PingContext is not supported.
 	/*
 	/*
 		ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 		ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)