mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-18 08:26:45 +02:00
41 lines
983 B
Go
41 lines
983 B
Go
|
package git
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestGitDepth(t *testing.T) {
|
||
|
var g *Git
|
||
|
var expected int
|
||
|
|
||
|
expected = DefaultGitDepth
|
||
|
g = nil
|
||
|
if actual := GitDepth(g); actual != expected {
|
||
|
t.Errorf("The result is invalid. [expected: %d][actual: %d]", expected, actual)
|
||
|
}
|
||
|
|
||
|
expected = DefaultGitDepth
|
||
|
g = &Git{}
|
||
|
if actual := GitDepth(g); actual != expected {
|
||
|
t.Errorf("The result is invalid. [expected: %d][actual: %d]", expected, actual)
|
||
|
}
|
||
|
|
||
|
expected = DefaultGitDepth
|
||
|
g = &Git{Depth: nil}
|
||
|
if actual := GitDepth(g); actual != expected {
|
||
|
t.Errorf("The result is invalid. [expected: %d][actual: %d]", expected, actual)
|
||
|
}
|
||
|
|
||
|
expected = 0
|
||
|
g = &Git{Depth: &expected}
|
||
|
if actual := GitDepth(g); actual != expected {
|
||
|
t.Errorf("The result is invalid. [expected: %d][actual: %d]", expected, actual)
|
||
|
}
|
||
|
|
||
|
expected = 1
|
||
|
g = &Git{Depth: &expected}
|
||
|
if actual := GitDepth(g); actual != expected {
|
||
|
t.Errorf("The result is invalid. [expected: %d][actual: %d]", expected, actual)
|
||
|
}
|
||
|
}
|