You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
666 B
34 lines
666 B
// Copyright 2019 The Xorm Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
var result = fmt.Sprintf(`package models
|
|
|
|
type A struct {
|
|
Id int %sxorm:"integer"%s
|
|
}
|
|
|
|
type B struct {
|
|
Id int %sxorm:"INTEGER"%s
|
|
}
|
|
`, "`", "`", "`", "`")
|
|
|
|
func TestReverse(t *testing.T) {
|
|
err := reverse("../example/goxorm.yml")
|
|
assert.NoError(t, err)
|
|
|
|
bs, err := ioutil.ReadFile("../models/models.go")
|
|
assert.NoError(t, err)
|
|
assert.EqualValues(t, result, string(bs))
|
|
}
|