Skip to content

Commit

Permalink
added few more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnester committed Aug 20, 2024
1 parent 9161e5c commit 40e1f83
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions bundle/libraries/local_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func IsLibraryLocal(dep string) bool {
// ^[a-zA-Z0-9\-_]+: Matches the package name, allowing alphanumeric characters, dashes (-), and underscores (_).
// \[.*\])?: Optionally matches any extras specified in square brackets, e.g., [security].
// ((==|!=|<=|>=|~=|>|<)\d+(\.\d+){0,2}(\.\*)?)?: Optionally matches version specifiers, supporting various operators (==, !=, etc.) followed by a version number (e.g., 2.25.1).
// Spec for package name and version specifier: https://pip.pypa.io/en/stable/reference/requirement-specifiers/
const packageRegex = `^[a-zA-Z0-9\-_]+(\[.*\])?\s?((==|!=|<=|>=|~=|==|>|<)\s?\d+(\.\d+){0,2}(\.\*)?)?$`

func isPackage(name string) bool {
Expand Down
1 change: 1 addition & 0 deletions bundle/libraries/local_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func TestIsLibraryLocal(t *testing.T) {
{path: "beautifulsoup4 ~= 4.12.3", expected: false},
{path: "beautifulsoup4[security, tests]", expected: false},
{path: "beautifulsoup4[security, tests] ~= 4.12.3", expected: false},
{path: "https://github.com/pypa/pip/archive/22.0.2.zip", expected: false},
}

for i, tc := range testCases {
Expand Down

0 comments on commit 40e1f83

Please sign in to comment.