123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package tests
- import (
- "archive/zip"
- "io"
- "os"
- "testing"
- "notabug.org/Umnik/GoAndroidSDK/v2/components/sdk"
- )
- func newSdk(t *testing.T, fnName string) *sdk.SDK {
- s, err := sdk.NewSDK()
- if !testErr(t, fnName, err) {
- return nil
- }
- return s
- }
- func closeOsFile(t *testing.T, fnName string, closer *os.File) {
- t.Helper()
- testErr(t, fnName, closer.Close())
- }
- func closeZipFile(t *testing.T, fnName string, closer *zip.ReadCloser) {
- t.Helper()
- testErr(t, fnName, closer.Close())
- }
- func removeOsFile(t *testing.T, fnName string, fileName string) {
- testErr(t, fnName, os.Remove(fileName))
- }
- func makeCopy(t *testing.T, fnName string, dest io.Writer, source string) bool {
- t.Helper()
- src, err := os.Open(source)
- if !testErr(t, fnName, err) {
- return false
- }
- defer closeOsFile(t, fnName, src)
- _, err = io.Copy(dest, src)
- return testErr(t, fnName, err)
- }
- func testErr(t *testing.T, funcName string, err error) bool {
- if err != nil {
- t.Errorf("%v failed with: %q", funcName, err)
- return false
- }
- return true
- }
- func goodApkFile() string {
- return "saveto.apk"
- }
- func split_base() string {
- return "base_split.apk"
- }
|