session_test.go 480 B

1234567891011121314151617181920212223
  1. // Copyright 2017 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package xorm
  5. import (
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func TestClose(t *testing.T) {
  10. assert.NoError(t, prepareEngine())
  11. sess1 := testEngine.NewSession()
  12. sess1.Close()
  13. assert.True(t, sess1.IsClosed())
  14. sess2 := testEngine.Where("a = ?", 1)
  15. sess2.Close()
  16. assert.True(t, sess2.IsClosed())
  17. }