From 24bbc8ab2f32b0dfd9f4682565c8a3edefa1909a Mon Sep 17 00:00:00 2001 From: Petr Korobeinikov Date: Sat, 20 Feb 2021 15:58:01 +0300 Subject: [PATCH] #20 make tests black-boxed. --- internal/args_test.go | 4 +++- internal/cfg_test.go | 4 +++- internal/clone_test.go | 4 +++- internal/homedir_test.go | 4 +++- internal/lookup_test.go | 4 +++- internal/postcmd_test.go | 8 ++++++-- internal/scmurl_test.go | 4 +++- main.go | 1 + 8 files changed, 25 insertions(+), 8 deletions(-) diff --git a/internal/args_test.go b/internal/args_test.go index 1a7a150..4801c80 100644 --- a/internal/args_test.go +++ b/internal/args_test.go @@ -1,8 +1,10 @@ -package internal +package internal_test import ( "fmt" "testing" + + . "scm/internal" ) func TestParseArgs(t *testing.T) { diff --git a/internal/cfg_test.go b/internal/cfg_test.go index 29c3f2a..8437bd7 100644 --- a/internal/cfg_test.go +++ b/internal/cfg_test.go @@ -1,9 +1,11 @@ -package internal +package internal_test import ( "os" "reflect" "testing" + + . "scm/internal" ) func TestReadCfg(t *testing.T) { diff --git a/internal/clone_test.go b/internal/clone_test.go index 96de75f..91aa313 100644 --- a/internal/clone_test.go +++ b/internal/clone_test.go @@ -1,8 +1,10 @@ -package internal +package internal_test import ( "os" "testing" + + . "scm/internal" ) func TestPrepareLocalWorkingCopyPath(t *testing.T) { diff --git a/internal/homedir_test.go b/internal/homedir_test.go index 2069f6d..5b099ad 100644 --- a/internal/homedir_test.go +++ b/internal/homedir_test.go @@ -1,8 +1,10 @@ -package internal +package internal_test import ( "os" "testing" + + . "scm/internal" ) func TestExpandHomeDir(t *testing.T) { diff --git a/internal/lookup_test.go b/internal/lookup_test.go index 0c7e07e..2cf2377 100644 --- a/internal/lookup_test.go +++ b/internal/lookup_test.go @@ -1,8 +1,10 @@ -package internal +package internal_test import ( "os" "testing" + + . "scm/internal" ) func TestLookupEnvOrDefault(t *testing.T) { diff --git a/internal/postcmd_test.go b/internal/postcmd_test.go index 56cbf06..f3649f0 100644 --- a/internal/postcmd_test.go +++ b/internal/postcmd_test.go @@ -1,6 +1,10 @@ -package internal +package internal_test -import "testing" +import ( + "testing" + + . "scm/internal" +) func TestExecutePostCmd(t *testing.T) { t.Run(`positive`, func(t *testing.T) { diff --git a/internal/scmurl_test.go b/internal/scmurl_test.go index 75fe868..f982116 100644 --- a/internal/scmurl_test.go +++ b/internal/scmurl_test.go @@ -1,8 +1,10 @@ -package internal +package internal_test import ( "fmt" "testing" + + . "scm/internal" ) func TestExtractLocalPathFromScmURL(t *testing.T) { diff --git a/main.go b/main.go index 267df30..633a000 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "log" "os" + . "scm/internal" )