This repository has been archived by the owner on Mar 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep legal files when vendoring tools (#8)
* Keep legal files when vendoring tools * Bump version to v1.1.0 * Use a broader pile of legal file hints
- Loading branch information
Showing
4 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestIsLegalFile(t *testing.T) { | ||
testcase := func(filename string, want bool) { | ||
t.Run(filename, func(t *testing.T) { | ||
have := isLegalFile(filename) | ||
if have != want { | ||
t.Fail() | ||
} | ||
}) | ||
} | ||
|
||
testcase("license.md", true) | ||
testcase("license.txt", true) | ||
testcase("LICENSE", true) | ||
testcase("LICENCE", true) | ||
testcase("LICENSE.md", true) | ||
testcase(filepath.Join("pkg", "LICENSE.md"), true) | ||
testcase("LEGAL", true) | ||
testcase("README", true) | ||
testcase("COPYING", true) | ||
testcase("COPYRIGHT", true) | ||
testcase("UNLICENSE", true) | ||
testcase("PATENTS", true) | ||
|
||
testcase(filepath.Join("pat", "ents"), false) | ||
testcase("picture.jpeg", false) | ||
} | ||
|
||
func TestKeep(t *testing.T) { | ||
testcase := func(filename string, want bool) { | ||
t.Run(filename, func(t *testing.T) { | ||
have := keepFile(filename) | ||
if have != want { | ||
t.Fail() | ||
} | ||
}) | ||
} | ||
|
||
testcase("program.go", true) | ||
testcase("program_test.go", false) | ||
testcase(filepath.Join("pkg", "program.go"), true) | ||
testcase(filepath.Join("pkg", "program_test.go"), false) | ||
|
||
testcase("assembly.s", true) | ||
testcase("notassembly.as", false) | ||
testcase("picture.gif", false) | ||
testcase("LICENSE.md", true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import ( | |
"path/filepath" | ||
) | ||
|
||
const version = "v1.0.3" | ||
const version = "v1.1.0" | ||
|
||
var cacheDir = "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters