mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-29 21:16:44 +00:00
feat(GODT-2373): bridgelib tests.
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user