mirror of https://github.com/go-python/gopy.git
bind: test more basic named types ctor
Change-Id: Ibc519364561f464c2d00fd3836b3d01a4ce29a92
This commit is contained in:
parent
90fb7cc80b
commit
536b44dd2a
|
@ -17,3 +17,15 @@ func (x X) Value() float32 { return float32(x) }
|
|||
func (x XX) Value() float32 { return float32(x) }
|
||||
func (x XXX) Value() float32 { return float32(x) }
|
||||
func (x XXXX) Value() float32 { return float32(x) }
|
||||
|
||||
type Str string
|
||||
|
||||
func (s Str) Value() string { return string(s) }
|
||||
|
||||
type Slice []float64
|
||||
|
||||
func (s Slice) At(i int) float64 { return s[i] }
|
||||
|
||||
type Array [2]float64
|
||||
|
||||
func (a Array) At(i int) float64 { return a[i] }
|
||||
|
|
|
@ -69,3 +69,13 @@ x = named.XXXX(42.0)
|
|||
print("x = %s" % (x,))
|
||||
print("x.Value() = %s" % (x.Value(),))
|
||||
|
||||
print("s = named.Str()")
|
||||
s = named.Str()
|
||||
print("s = %s" % (s,))
|
||||
print("s.Value() = %r" % (s.Value(),))
|
||||
|
||||
print("s = named.Str('string')")
|
||||
s = named.Str("string")
|
||||
print("s = %s" % (s,))
|
||||
print("s.Value() = %r" % (s.Value(),))
|
||||
|
||||
|
|
|
@ -203,6 +203,9 @@ func (p *Package) process() error {
|
|||
case *types.Basic:
|
||||
// ok. handled by p.syms-types
|
||||
|
||||
case *types.Array:
|
||||
// ok. handled by p.syms-types
|
||||
|
||||
case *types.Signature:
|
||||
// ok. handled by p.syms-types
|
||||
|
||||
|
|
|
@ -292,6 +292,12 @@ x.Value() = 42.0
|
|||
x = named.XXXX(42.0)
|
||||
x = 42
|
||||
x.Value() = 42.0
|
||||
s = named.Str()
|
||||
s = ""
|
||||
s.Value() = ''
|
||||
s = named.Str('string')
|
||||
s = "string"
|
||||
s.Value() = 'string'
|
||||
`),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue