macros_test.go 417 B

12345678910111213141516171819202122
  1. package mysql
  2. import (
  3. "testing"
  4. . "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestMacroEngine(t *testing.T) {
  7. Convey("MacroEngine", t, func() {
  8. Convey("interpolate simple function", func() {
  9. engine := &MySqlMacroEngine{}
  10. sql, err := engine.Interpolate("select $__time(time_column)")
  11. So(err, ShouldBeNil)
  12. So(sql, ShouldEqual, "select UNIX_TIMESTAMP(time_column) as time_sec")
  13. })
  14. })
  15. }