@@ -4249,8 +4249,6 @@ type BytesChan chan []byte
42494249type BytesChanRecv <- chan []byte
42504250type BytesChanSend chan <- []byte
42514251
4252- /*
4253-
42544252var convertTests = []struct {
42554253 in Value
42564254 out Value
@@ -4286,7 +4284,7 @@ var convertTests = []struct {
42864284 }
42874285 }
42884286 }
4289- */ /*
4287+ */
42904288 {V (int8 (1 )), V (int8 (1 ))},
42914289 {V (int8 (2 )), V (uint8 (2 ))},
42924290 {V (uint8 (3 )), V (int8 (3 ))},
@@ -4602,37 +4600,41 @@ var convertTests = []struct {
46024600 {V ((func ())(nil )), V (MyFunc (nil ))},
46034601 {V ((MyFunc )(nil )), V ((func ())(nil ))},
46044602
4605- // structs with different tags
4606- {V(struct {
4607- x int `some:"foo"`
4608- }{}), V(struct {
4609- x int `some:"bar"`
4610- }{})},
4603+ /*
4604+
4605+ // structs with different tags
4606+ {V(struct {
4607+ x int `some:"foo"`
4608+ }{}), V(struct {
4609+ x int `some:"bar"`
4610+ }{})},
46114611
4612- {V(struct {
4613- x int `some:"bar"`
4614- }{}), V(struct {
4615- x int `some:"foo"`
4616- }{})},
4612+ {V(struct {
4613+ x int `some:"bar"`
4614+ }{}), V(struct {
4615+ x int `some:"foo"`
4616+ }{})},
46174617
4618- {V(MyStruct{}), V(struct {
4619- x int `some:"foo"`
4620- }{})},
4618+ {V(MyStruct{}), V(struct {
4619+ x int `some:"foo"`
4620+ }{})},
46214621
4622- {V(struct {
4623- x int `some:"foo"`
4624- }{}), V(MyStruct{})},
4622+ {V(struct {
4623+ x int `some:"foo"`
4624+ }{}), V(MyStruct{})},
46254625
4626- {V(MyStruct{}), V(struct {
4627- x int `some:"bar"`
4628- }{})},
4626+ {V(MyStruct{}), V(struct {
4627+ x int `some:"bar"`
4628+ }{})},
46294629
4630- {V(struct {
4631- x int `some:"bar"`
4632- }{}), V(MyStruct{})},
4630+ {V(struct {
4631+ x int `some:"bar"`
4632+ }{}), V(MyStruct{})},
46334633
4634- {V(MyStruct1{}), V(MyStruct2{})},
4635- {V(MyStruct2{}), V(MyStruct1{})},
4634+
4635+ {V(MyStruct1{}), V(MyStruct2{})},
4636+ {V(MyStruct2{}), V(MyStruct1{})},
4637+ */
46364638
46374639 // can convert *byte and *MyByte
46384640 {V ((* byte )(nil )), V ((* MyByte )(nil ))},
@@ -4674,46 +4676,59 @@ var convertTests = []struct {
46744676 {V (new (io.Reader )), V (new (io.Reader ))},
46754677 {V (new (io.Writer )), V (new (io.Writer ))},
46764678
4677- // channels
4678- {V(IntChan(nil)), V((chan<- int)(nil))},
4679- {V(IntChan(nil)), V((<-chan int)(nil))},
4680- {V((chan int)(nil)), V(IntChanRecv(nil))},
4681- {V((chan int)(nil)), V(IntChanSend(nil))},
4682- {V(IntChanRecv(nil)), V((<-chan int)(nil))},
4683- {V((<-chan int)(nil)), V(IntChanRecv(nil))},
4684- {V(IntChanSend(nil)), V((chan<- int)(nil))},
4685- {V((chan<- int)(nil)), V(IntChanSend(nil))},
4686- {V(IntChan(nil)), V((chan int)(nil))},
4687- {V((chan int)(nil)), V(IntChan(nil))},
4688- {V((chan int)(nil)), V((<-chan int)(nil))},
4689- {V((chan int)(nil)), V((chan<- int)(nil))},
4690- {V(BytesChan(nil)), V((chan<- []byte)(nil))},
4691- {V(BytesChan(nil)), V((<-chan []byte)(nil))},
4692- {V((chan []byte)(nil)), V(BytesChanRecv(nil))},
4693- {V((chan []byte)(nil)), V(BytesChanSend(nil))},
4694- {V(BytesChanRecv(nil)), V((<-chan []byte)(nil))},
4695- {V((<-chan []byte)(nil)), V(BytesChanRecv(nil))},
4696- {V(BytesChanSend(nil)), V((chan<- []byte)(nil))},
4697- {V((chan<- []byte)(nil)), V(BytesChanSend(nil))},
4698- {V(BytesChan(nil)), V((chan []byte)(nil))},
4699- {V((chan []byte)(nil)), V(BytesChan(nil))},
4700- {V((chan []byte)(nil)), V((<-chan []byte)(nil))},
4701- {V((chan []byte)(nil)), V((chan<- []byte)(nil))},
4702-
4703- // cannot convert other instances (channels)
4704- {V(IntChan(nil)), V(IntChan(nil))},
4705- {V(IntChanRecv(nil)), V(IntChanRecv(nil))},
4706- {V(IntChanSend(nil)), V(IntChanSend(nil))},
4707- {V(BytesChan(nil)), V(BytesChan(nil))},
4708- {V(BytesChanRecv(nil)), V(BytesChanRecv(nil))},
4709- {V(BytesChanSend(nil)), V(BytesChanSend(nil))},
4710-
4711- // interfaces
4712- {V(int(1)), EmptyInterfaceV(int(1))},
4713- {V(string("hello")), EmptyInterfaceV(string("hello"))},
4714- {V(new(bytes.Buffer)), ReaderV(new(bytes.Buffer))},
4715- {ReadWriterV(new(bytes.Buffer)), ReaderV(new(bytes.Buffer))},
4716- {V(new(bytes.Buffer)), ReadWriterV(new(bytes.Buffer))},
4679+ /*
4680+
4681+ // channels
4682+ {V(IntChan(nil)), V((chan<- int)(nil))},
4683+ {V(IntChan(nil)), V((<-chan int)(nil))},
4684+ {V((chan int)(nil)), V(IntChanRecv(nil))},
4685+ {V((chan int)(nil)), V(IntChanSend(nil))},
4686+ {V(IntChanRecv(nil)), V((<-chan int)(nil))},
4687+ {V((<-chan int)(nil)), V(IntChanRecv(nil))},
4688+ {V(IntChanSend(nil)), V((chan<- int)(nil))},
4689+ {V((chan<- int)(nil)), V(IntChanSend(nil))},
4690+ {V(IntChan(nil)), V((chan int)(nil))},
4691+ {V((chan int)(nil)), V(IntChan(nil))},
4692+ {V((chan int)(nil)), V((<-chan int)(nil))},
4693+ {V((chan int)(nil)), V((chan<- int)(nil))},
4694+ {V(BytesChan(nil)), V((chan<- []byte)(nil))},
4695+ {V(BytesChan(nil)), V((<-chan []byte)(nil))},
4696+ {V((chan []byte)(nil)), V(BytesChanRecv(nil))},
4697+ {V((chan []byte)(nil)), V(BytesChanSend(nil))},
4698+ {V(BytesChanRecv(nil)), V((<-chan []byte)(nil))},
4699+ {V((<-chan []byte)(nil)), V(BytesChanRecv(nil))},
4700+ {V(BytesChanSend(nil)), V((chan<- []byte)(nil))},
4701+ {V((chan<- []byte)(nil)), V(BytesChanSend(nil))},
4702+ {V(BytesChan(nil)), V((chan []byte)(nil))},
4703+ {V((chan []byte)(nil)), V(BytesChan(nil))},
4704+ {V((chan []byte)(nil)), V((<-chan []byte)(nil))},
4705+ {V((chan []byte)(nil)), V((chan<- []byte)(nil))},
4706+
4707+ // cannot convert other instances (channels)
4708+ {V(IntChan(nil)), V(IntChan(nil))},
4709+ {V(IntChanRecv(nil)), V(IntChanRecv(nil))},
4710+ {V(IntChanSend(nil)), V(IntChanSend(nil))},
4711+ {V(BytesChan(nil)), V(BytesChan(nil))},
4712+ {V(BytesChanRecv(nil)), V(BytesChanRecv(nil))},
4713+ {V(BytesChanSend(nil)), V(BytesChanSend(nil))},
4714+
4715+ // interfaces
4716+ {V(int(1)), EmptyInterfaceV(int(1))},
4717+ {V(string("hello")), EmptyInterfaceV(string("hello"))},
4718+ {V(new(bytes.Buffer)), ReaderV(new(bytes.Buffer))},
4719+ {ReadWriterV(new(bytes.Buffer)), ReaderV(new(bytes.Buffer))},
4720+ {V(new(bytes.Buffer)), ReadWriterV(new(bytes.Buffer))},
4721+ */
4722+
4723+ }
4724+
4725+ func IsRO (v Value ) bool {
4726+ return v .IsRO ()
4727+ }
4728+
4729+ func MakeRO (v Value ) Value {
4730+ v .MakeRO (true )
4731+ return v
47174732}
47184733
47194734func TestConvert (t * testing.T ) {
@@ -4804,6 +4819,8 @@ func TestConvert(t *testing.T) {
48044819 }
48054820}
48064821
4822+ /*
4823+
48074824func TestConvertPanic(t *testing.T) {
48084825 s := make([]byte, 4)
48094826 p := new([8]byte)
@@ -4848,6 +4865,8 @@ func TestConvertSlice2Array(t *testing.T) {
48484865 }
48494866}
48504867
4868+ */
4869+
48514870var gFloat32 float32
48524871
48534872const snan uint32 = 0x7f800001
@@ -4870,8 +4889,6 @@ func TestConvertNaNs(t *testing.T) {
48704889 }
48714890}
48724891
4873- */
4874-
48754892type ComparableStruct struct {
48764893 X int
48774894}
0 commit comments