add example which registers and uses go custom elements

this example has an assert that checks wether or nor the finalizers ran correctly. If they don't then a mem leak will happen
This commit is contained in:
RSWilli
2024-11-15 15:28:37 +01:00
parent 17ef73066a
commit 72543a2372
11 changed files with 426 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
package common
import "fmt"
var FinalizersCalled int = 0
func AssertFinalizersCalled(x int) {
if FinalizersCalled != x {
panic(fmt.Sprintf("finalizers did not run correctly, memory leak, wanted: %d, got: %d", x, FinalizersCalled))
}
}