|
5 | 5 | "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" |
6 | 6 | "github.com/jfrog/jfrog-cli-core/v2/utils/tests" |
7 | 7 | "github.com/jfrog/jfrog-cli-security/utils/techutils" |
| 8 | + "github.com/owenrumney/go-sarif/v2/sarif" |
8 | 9 | "os" |
9 | 10 | "path/filepath" |
10 | 11 | "strings" |
@@ -72,6 +73,22 @@ func TestGetTechDependencyLocation(t *testing.T) { |
72 | 73 | assert.Equal(t, *locations[0].PhysicalLocation.Region.Snippet.Text, "GoogleSignIn', '~> 6.2.4'") |
73 | 74 | } |
74 | 75 |
|
| 76 | +func TestPodLineParse(t *testing.T) { |
| 77 | + var podPositions []*sarif.Location |
| 78 | + foundDependency, _, startLine, startCol := parsePodLine("pod 'GoogleSignIn', '~> 6.2.4'", "GoogleSignIn", "6.2.4", "test", 0, 0, 0, 0, 0, 0, []string{"pod 'GoogleSignIn', '~> 6.2.4'"}, false, &podPositions) |
| 79 | + assert.Equal(t, foundDependency, false) |
| 80 | + assert.Equal(t, startLine, 0) |
| 81 | + assert.Equal(t, startCol, 5) |
| 82 | +} |
| 83 | + |
| 84 | +func TestPodLineParseFoundOnlyDependencyName(t *testing.T) { |
| 85 | + var podPositions []*sarif.Location |
| 86 | + foundDependency, _, startLine, startCol := parsePodLine("pod 'GoogleSignIn', '~> 6.2.3'", "GoogleSignIn", "6.2.4", "test", 0, 0, 0, 0, 0, 0, []string{"pod 'GoogleSignIn', '~> 6.2.3'"}, false, &podPositions) |
| 87 | + assert.Equal(t, foundDependency, true) |
| 88 | + assert.Equal(t, startLine, 0) |
| 89 | + assert.Equal(t, startCol, 5) |
| 90 | +} |
| 91 | + |
75 | 92 | func TestFixTechDependencySingleLocation(t *testing.T) { |
76 | 93 | _, cleanUp := sca.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods")) |
77 | 94 | defer cleanUp() |
|
0 commit comments