-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Liam White <[email protected]>
- Loading branch information
1 parent
5aff729
commit 60538ed
Showing
7 changed files
with
88 additions
and
3 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
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,58 @@ | ||
// Copyright 2019 Liam White | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package license | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestApache20_Reader(t *testing.T) { | ||
t.Run("Reader has correct bytes", func(t *testing.T) { | ||
a := NewApache20(2019, "Test") | ||
want, _ := ioutil.ReadFile("testdata/apache.golden") | ||
got, _ := ioutil.ReadAll(a.Reader()) | ||
assert.Equal(t, want, got) | ||
}) | ||
} | ||
|
||
func TestApache20_IsPresent(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
inputFile string | ||
want bool | ||
}{ | ||
{ | ||
name: "License is present", | ||
inputFile: "testdata/apache.golden", | ||
want: true, | ||
}, | ||
{ | ||
name: "License is not present", | ||
inputFile: "testdata/nolicense.golden", | ||
want: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
a := &Apache20{} | ||
inputReader, _ := os.Open(tt.inputFile) | ||
assert.Equal(t, tt.want, a.IsPresent(inputReader)) | ||
}) | ||
} | ||
} |
File renamed without changes.
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,13 @@ | ||
Copyright 2019 Test | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,9 @@ | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras at vehicula urna, vitae fermentum mauris. Aenean consectetur lectus ligula, vitae finibus lectus pretium eu. Morbi nec mauris purus. Sed ut dictum magna, in luctus turpis. Nam sagittis in eros quis aliquam. Etiam quis semper purus. Cras eget neque quis dui rhoncus tempus. Quisque vehicula eget sapien ac mattis. | ||
|
||
Cras suscipit consequat sem, in hendrerit velit sagittis ut. Sed vitae nisl ligula. Morbi molestie sed sem quis condimentum. Fusce interdum rhoncus urna, vitae aliquam orci feugiat ut. Phasellus sollicitudin sagittis aliquam. Maecenas vitae erat nibh. Nam vel turpis dui. Mauris gravida leo aliquam, feugiat nisl in, facilisis erat. Morbi sed nunc elit. In nec felis mauris. | ||
|
||
Etiam at eros id nulla interdum rhoncus eget eu orci. Etiam pulvinar vulputate dapibus. Nunc iaculis arcu sit amet lorem posuere maximus nec quis dolor. Donec aliquet diam luctus, luctus justo a, laoreet dolor. Fusce volutpat justo a metus tristique aliquam. Pellentesque maximus libero quam, a posuere justo consequat id. Nunc vel laoreet ipsum. Curabitur malesuada sodales leo vel laoreet. Integer in hendrerit eros, sit amet fermentum justo. Suspendisse in libero iaculis, dictum libero nec, convallis turpis. Aliquam erat volutpat. Phasellus condimentum imperdiet scelerisque. | ||
|
||
Donec facilisis lorem at vehicula semper. Vivamus malesuada nulla nulla, et placerat orci dapibus at. Quisque commodo viverra varius. Sed et semper urna. Etiam laoreet est massa, a tempor libero pulvinar in. Vestibulum ac est lectus. Praesent interdum finibus pretium. Donec quis turpis et est tincidunt aliquet. Nunc tempor dolor ac volutpat mollis. Morbi egestas elementum turpis, eget posuere felis commodo sed. | ||
|
||
Nunc posuere sollicitudin aliquet. In feugiat vel leo et porta. Pellentesque commodo tempus purus, quis ultrices neque lobortis at. Proin finibus nunc massa, nec vulputate dui molestie ac. In porttitor ac lorem eu viverra. Aliquam eu dignissim nulla. Integer auctor augue non tellus efficitur vestibulum. In sed condimentum orci. Aenean imperdiet enim in malesuada condimentum. Morbi tincidunt ante ligula, nec mattis sapien congue in. |