feat(GODT-2373): bridgelib tests.

This commit is contained in:
Xavier Michelon
2023-02-20 12:59:47 +01:00
parent a741ffb595
commit 0b796f4401
2 changed files with 46 additions and 0 deletions

View File

@ -106,3 +106,11 @@ func withLocationProvider(fn func(provider *locations.DefaultProvider) string) *
return C.CString(fn(locs))
}
// cStringToGoString converts a cString to a GoString and release the memory for the C-String. This function is implemented
// here because cgo code is not allowed in Go test files.
func cStringToGoString(cStr *C.char) string {
str := C.GoString(cStr)
DeleteCString(cStr) // preferred over a direct call to C.free so that the former is covered in tests.
return str
}