mirror of
https://github.com/hanzoai/expr.git
synced 2026-09-24 16:58:58 +00:00
Remove litter dep
This commit is contained in:
+2
-3
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/antonmedv/expr/optimizer"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/sanity-io/litter"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -143,7 +142,7 @@ func runProgram() {
|
||||
out, err := vm.Run(program, nil)
|
||||
check(err)
|
||||
|
||||
litter.Dump(out)
|
||||
fmt.Printf("%#v", out)
|
||||
}
|
||||
|
||||
func startRepl() {
|
||||
@@ -158,7 +157,7 @@ func startRepl() {
|
||||
goto prompt
|
||||
}
|
||||
|
||||
fmt.Printf("%v\n", litter.Sdump(out))
|
||||
fmt.Printf("%#v\n", out)
|
||||
|
||||
prompt:
|
||||
fmt.Print("> ")
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ type TypeName string
|
||||
type Context struct {
|
||||
Variables map[Identifier]*Type `json:"variables"`
|
||||
Types map[TypeName]*Type `json:"types"`
|
||||
pkgPath string
|
||||
PkgPath string
|
||||
}
|
||||
|
||||
type Type struct {
|
||||
@@ -53,7 +53,7 @@ func CreateDoc(i interface{}) *Context {
|
||||
c := &Context{
|
||||
Variables: make(map[Identifier]*Type),
|
||||
Types: make(map[TypeName]*Type),
|
||||
pkgPath: dereference(reflect.TypeOf(i)).PkgPath(),
|
||||
PkgPath: dereference(reflect.TypeOf(i)).PkgPath(),
|
||||
}
|
||||
|
||||
for name, t := range conf.CreateTypesTable(i) {
|
||||
@@ -174,7 +174,7 @@ func (c *Context) use(t reflect.Type, ops ...option) *Type {
|
||||
appendix:
|
||||
|
||||
name := TypeName(t.String())
|
||||
if c.pkgPath == t.PkgPath() {
|
||||
if c.PkgPath == t.PkgPath() {
|
||||
name = TypeName(t.Name())
|
||||
}
|
||||
anonymous := t.Name() == ""
|
||||
|
||||
@@ -2,7 +2,6 @@ package docgen_test
|
||||
|
||||
import (
|
||||
. "github.com/antonmedv/expr/docgen"
|
||||
"github.com/sanity-io/litter"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"math"
|
||||
@@ -127,9 +126,10 @@ func TestCreateDoc(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
PkgPath: "github.com/antonmedv/expr/docgen_test",
|
||||
}
|
||||
|
||||
assert.Equal(t, litter.Sdump(expected), litter.Sdump(doc))
|
||||
assert.EqualValues(t, expected, doc)
|
||||
}
|
||||
|
||||
type A struct {
|
||||
@@ -193,9 +193,10 @@ func TestCreateDoc_Ambiguous(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
PkgPath: "github.com/antonmedv/expr/docgen_test",
|
||||
}
|
||||
|
||||
assert.Equal(t, litter.Sdump(expected), litter.Sdump(doc))
|
||||
assert.EqualValues(t, expected, doc)
|
||||
}
|
||||
|
||||
func TestCreateDoc_FromMap(t *testing.T) {
|
||||
@@ -244,7 +245,7 @@ func TestCreateDoc_FromMap(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
require.Equal(t, litter.Sdump(expected), litter.Sdump(doc))
|
||||
require.EqualValues(t, expected, doc)
|
||||
}
|
||||
|
||||
func TestContext_Markdown(t *testing.T) {
|
||||
|
||||
@@ -5,6 +5,5 @@ go 1.13
|
||||
require (
|
||||
github.com/gdamore/tcell v1.3.0
|
||||
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498
|
||||
github.com/sanity-io/litter v1.5.5
|
||||
github.com/stretchr/testify v1.8.0
|
||||
)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -13,18 +12,14 @@ github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
|
||||
github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498 h1:4CFNy7/q7P06AsIONZzuWy7jcdqEmYQvOZ9FAFZdbls=
|
||||
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498/go.mod h1:6lkG1x+13OShEf0EaOCaTQYyB7d5nSbb181KtjlS+84=
|
||||
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQo=
|
||||
github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
. "github.com/antonmedv/expr/vm"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/sanity-io/litter"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -43,7 +42,7 @@ func StartDebugger(program *Program, env interface{}) {
|
||||
result.
|
||||
SetBorder(true).
|
||||
SetTitle("Output")
|
||||
result.SetText(litter.Sdump(out))
|
||||
result.SetText(fmt.Sprintf("%#v", out))
|
||||
sub.AddItem(result, 0, 1, false)
|
||||
if err != nil {
|
||||
errorView := tview.NewTextView()
|
||||
|
||||
Reference in New Issue
Block a user