tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
14.72k stars 858 forks source link

src/reflect: uncomment more tests that pass #4276

Closed dgryski closed 1 month ago

dgryski commented 1 month ago
--- ref2.out    2024-05-28 10:59:51
+++ ref.out 2024-05-28 11:05:38
@@ -140,6 +140,14 @@
 --- PASS: TestImportPath (0.00s)
 === RUN   TestFieldPkgPath
 --- PASS: TestFieldPkgPath (0.00s)
+=== RUN   TestUnexportedMethods
+--- PASS: TestUnexportedMethods (0.00s)
+=== RUN   TestNumMethodOnDDD
+--- PASS: TestNumMethodOnDDD (0.00s)
+=== RUN   TestAddr
+--- PASS: TestAddr (0.00s)
+=== RUN   TestAllocations
+--- PASS: TestAllocations (0.00s)
 === RUN   TestSmallNegativeInt
 --- PASS: TestSmallNegativeInt (0.00s)
 === RUN   TestIndex

There might be more we can make work but these ones directly call NumMethods (and nothing else).

dgryski commented 1 month ago

This takes the file from being 74.8% commented to 72.3% commented.

Updated newly passing tests:

~/go/src/github.com/tinygo-org/tinygo/src/reflect $ diff -u ref2.out ref.out
--- ref2.out    2024-05-28 10:59:51
+++ ref.out 2024-05-28 13:39:18
@@ -28,6 +28,8 @@
 --- PASS: TestPtrSetNil (0.00s)
 === RUN   TestMapSetNil
 --- PASS: TestMapSetNil (0.00s)
+=== RUN   TestAll
+--- PASS: TestAll (0.00s)
 === RUN   TestInterfaceGet
 --- PASS: TestInterfaceGet (0.00s)
 === RUN   TestInterfaceValue
@@ -120,12 +122,92 @@
 --- PASS: TestDeepEqualComplexStructInequality (0.00s)
 === RUN   TestDeepEqualUnexportedMap
 --- PASS: TestDeepEqualUnexportedMap (0.00s)
+=== RUN   TestDeepEqualAllocs
+=== RUN   TestDeepEqualAllocs/int8
+    --- PASS: TestDeepEqualAllocs/int8 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]int8
+    --- PASS: TestDeepEqualAllocs/[]int8 (0.00s)
+=== RUN   TestDeepEqualAllocs/int16
+    --- PASS: TestDeepEqualAllocs/int16 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]int16
+    --- PASS: TestDeepEqualAllocs/[]int16 (0.00s)
+=== RUN   TestDeepEqualAllocs/int32
+    --- PASS: TestDeepEqualAllocs/int32 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]int32
+    --- PASS: TestDeepEqualAllocs/[]int32 (0.00s)
+=== RUN   TestDeepEqualAllocs/int64
+    --- PASS: TestDeepEqualAllocs/int64 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]int64
+    --- PASS: TestDeepEqualAllocs/[]int64 (0.00s)
+=== RUN   TestDeepEqualAllocs/int
+    --- PASS: TestDeepEqualAllocs/int (0.00s)
+=== RUN   TestDeepEqualAllocs/[]int
+    --- PASS: TestDeepEqualAllocs/[]int (0.00s)
+=== RUN   TestDeepEqualAllocs/uint8
+    --- PASS: TestDeepEqualAllocs/uint8 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]uint8
+    --- PASS: TestDeepEqualAllocs/[]uint8 (0.00s)
+=== RUN   TestDeepEqualAllocs/uint16
+    --- PASS: TestDeepEqualAllocs/uint16 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]uint16
+    --- PASS: TestDeepEqualAllocs/[]uint16 (0.00s)
+=== RUN   TestDeepEqualAllocs/uint32
+    --- PASS: TestDeepEqualAllocs/uint32 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]uint32
+    --- PASS: TestDeepEqualAllocs/[]uint32 (0.00s)
+=== RUN   TestDeepEqualAllocs/uint64
+    --- PASS: TestDeepEqualAllocs/uint64 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]uint64
+    --- PASS: TestDeepEqualAllocs/[]uint64 (0.00s)
+=== RUN   TestDeepEqualAllocs/uint
+    --- PASS: TestDeepEqualAllocs/uint (0.00s)
+=== RUN   TestDeepEqualAllocs/[]uint
+    --- PASS: TestDeepEqualAllocs/[]uint (0.00s)
+=== RUN   TestDeepEqualAllocs/uintptr
+    --- PASS: TestDeepEqualAllocs/uintptr (0.00s)
+=== RUN   TestDeepEqualAllocs/[]uintptr
+    --- PASS: TestDeepEqualAllocs/[]uintptr (0.00s)
+=== RUN   TestDeepEqualAllocs/float32
+    --- PASS: TestDeepEqualAllocs/float32 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]float32
+    --- PASS: TestDeepEqualAllocs/[]float32 (0.00s)
+=== RUN   TestDeepEqualAllocs/float64
+    --- PASS: TestDeepEqualAllocs/float64 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]float64
+    --- PASS: TestDeepEqualAllocs/[]float64 (0.00s)
+=== RUN   TestDeepEqualAllocs/complex64
+    --- PASS: TestDeepEqualAllocs/complex64 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]complex64
+    --- PASS: TestDeepEqualAllocs/[]complex64 (0.00s)
+=== RUN   TestDeepEqualAllocs/complex128
+    --- PASS: TestDeepEqualAllocs/complex128 (0.00s)
+=== RUN   TestDeepEqualAllocs/[]complex128
+    --- PASS: TestDeepEqualAllocs/[]complex128 (0.00s)
+=== RUN   TestDeepEqualAllocs/bool
+    --- PASS: TestDeepEqualAllocs/bool (0.00s)
+=== RUN   TestDeepEqualAllocs/[]bool
+    --- PASS: TestDeepEqualAllocs/[]bool (0.00s)
+=== RUN   TestDeepEqualAllocs/string
+    --- PASS: TestDeepEqualAllocs/string (0.00s)
+=== RUN   TestDeepEqualAllocs/[]string
+    --- PASS: TestDeepEqualAllocs/[]string (0.00s)
+=== RUN   TestDeepEqualAllocs/[]uint8#01
+    --- PASS: TestDeepEqualAllocs/[]uint8#01 (0.00s)
+=== RUN   TestDeepEqualAllocs/[][]uint8
+    --- PASS: TestDeepEqualAllocs/[][]uint8 (0.00s)
+=== RUN   TestDeepEqualAllocs/[6]uint8
+    --- PASS: TestDeepEqualAllocs/[6]uint8 (0.00s)
+=== RUN   TestDeepEqualAllocs/[][6]uint8
+    --- PASS: TestDeepEqualAllocs/[][6]uint8 (0.00s)
+--- PASS: TestDeepEqualAllocs (0.02s)
 === RUN   TestAlignment
 --- PASS: TestAlignment (0.00s)
 === RUN   TestIsNil
 --- PASS: TestIsNil (0.00s)
 === RUN   TestIsZero
 --- PASS: TestIsZero (0.00s)
+=== RUN   TestInterfaceExtraction
+--- PASS: TestInterfaceExtraction (0.00s)
 === RUN   TestNilPtrValueSub
 --- PASS: TestNilPtrValueSub (0.00s)
 === RUN   TestMap
@@ -140,6 +222,14 @@
 --- PASS: TestImportPath (0.00s)
 === RUN   TestFieldPkgPath
 --- PASS: TestFieldPkgPath (0.00s)
+=== RUN   TestUnexportedMethods
+--- PASS: TestUnexportedMethods (0.00s)
+=== RUN   TestNumMethodOnDDD
+--- PASS: TestNumMethodOnDDD (0.00s)
+=== RUN   TestAddr
+--- PASS: TestAddr (0.00s)
+=== RUN   TestAllocations
+--- PASS: TestAllocations (0.00s)
 === RUN   TestSmallNegativeInt
 --- PASS: TestSmallNegativeInt (0.00s)
 === RUN   TestIndex
@@ -264,7 +354,7 @@
 === RUN   TestFields/EmbeddedPointerStruct
         field 0: SF
         field 1: F
-    --- PASS: TestFields/EmbeddedPointerStruct (0.00s)
+    --- PASS: TestFields/EmbeddedPointerStruct (0.01s)
 === RUN   TestFields/EmbeddedNotAPointer
         field 0: M
     --- PASS: TestFields/EmbeddedNotAPointer (0.00s)
@@ -283,8 +373,8 @@
         field 1: RS1
         field 2: i
     --- PASS: TestFields/RecursiveEmbedding3 (0.00s)
---- PASS: TestFields (0.00s)
+--- PASS: TestFields (0.01s)
 === RUN   TestFieldByIndexErr
 --- PASS: TestFieldByIndexErr (0.00s)
 PASS
-ok     reflect 0.363s
+ok     reflect 0.333s
deadprogram commented 1 month ago

Very cool that so much more of reflection is working! @dgryski will you add more to this PR or is it ready to merge? Also thanks @dkegel-fastly for review.

dgryski commented 1 month ago

Ready to merge. Might revisit this eventually.

aykevl commented 1 month ago

Awesome!