-
Notifications
You must be signed in to change notification settings - Fork 9
Config updates #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e75f16d
Move config test to other test-file, add priority and section to config
rikvdh 73f05c7
Add defaults, cleanup test
rikvdh 7add711
Add test for default configuration, more checking of demo-config, als…
rikvdh be1ceeb
Make config-reading more strict, also add test for non-existing confi…
rikvdh 7abb6dd
Add missing package for tests
rikvdh 57e3ba7
Add AUTHORS file and rework copyright headers
rikvdh 17fdcd0
Add missing comment
rikvdh 6397bb6
Fix some metalinter warnings
rikvdh 367998e
Simplify some calls and handle some errors
rikvdh 4721283
Recursively traverse directory for AddDirectory
rikvdh 478aec7
Remove 2017 from copyright, only 2016 is fine
rikvdh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,2 @@ | ||
| Jerry Jacobs (@xor-gate) | ||
| Rik van der Heijden (@rikvdh) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,80 @@ | ||
| // Copyright 2017 Debpkg authors. All rights reserved. | ||
| // Use of this source code is governed by the MIT | ||
| // license that can be found in the LICENSE file. | ||
|
|
||
| package debpkg | ||
|
|
||
| import ( | ||
| "io/ioutil" | ||
| "runtime" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| // TestExampleConfig verifies if the config example in the root is correctly loaded | ||
| func TestExampleConfig(t *testing.T) { | ||
| deb := New() | ||
|
|
||
| err := deb.Config("debpkg.yml") | ||
| if err != nil { | ||
| t.Errorf("debpkg.yml error: %v", err) | ||
| } | ||
| assert.Equal(t, "7.6.5", deb.control.info.version.full, | ||
| "Unexpected deb.control.info.version.full") | ||
| assert.Equal(t, "Foo Bar", deb.control.info.maintainer, | ||
| "Unexpected deb.control.info.maintainer") | ||
| assert.Equal(t, "foo@bar.com", deb.control.info.maintainerEmail, | ||
| "Unexpected deb.control.info.maintainerEmail") | ||
| assert.Equal(t, "https://github.com/xor-gate/debpkg", deb.control.info.homepage, | ||
| "Unexpected deb.control.info.homepage") | ||
| assert.Equal(t, "This is a short description", deb.control.info.descrShort, | ||
| "Unexpected short description") | ||
| assert.Equal(t, "golang", deb.control.info.builtUsing, | ||
| "unexpected built using") | ||
| assert.Equal(t, "devel", deb.control.info.section, | ||
| "unexpected section") | ||
| assert.Equal(t, PriorityStandard, deb.control.info.priority, | ||
| "unexpected priority") | ||
| } | ||
|
|
||
| func TestDefaultConfig(t *testing.T) { | ||
| f, err := ioutil.TempFile("", "config") | ||
| if err != nil { | ||
| t.Errorf("unexpected error creating tempfile: %v", err) | ||
| } | ||
| f.Close() | ||
| deb := New() | ||
| if err := deb.Config(f.Name()); err != nil { | ||
| t.Errorf("Unexpected error during load of empty config: %v", err) | ||
| } | ||
| assert.Equal(t, "any", deb.control.info.architecture, | ||
| "unexpected architecture") | ||
| assert.Equal(t, "anonymous", deb.control.info.maintainer, | ||
| "unexpected maintainer") | ||
| assert.Equal(t, "anon@foo.bar", deb.control.info.maintainerEmail, | ||
| "unexpected maintainer email") | ||
| assert.Equal(t, "https://www.google.com", deb.control.info.homepage, | ||
| "unexpected homepage") | ||
| assert.Equal(t, PriorityOptional, deb.control.info.priority, | ||
| "unexpected priority") | ||
| assert.Equal(t, "0.1.0+dev", deb.control.info.version.full, | ||
| "unexpected version") | ||
| assert.Equal(t, "misc", deb.control.info.section, | ||
| "unexpected section") | ||
| assert.Equal(t, "unknown", deb.control.info.name, | ||
| "unexpected name") | ||
| assert.Equal(t, runtime.Version(), deb.control.info.builtUsing, | ||
| "unexpected built using") | ||
| assert.Equal(t, "-", deb.control.info.descrShort, | ||
| "unexpected short description") | ||
| assert.Equal(t, " -", deb.control.info.descr, | ||
| "unexpected long description") | ||
| } | ||
|
|
||
| func TestNonExistingConfig(t *testing.T) { | ||
| deb := New() | ||
|
|
||
| err := deb.Config("/non/existant/config/file") | ||
| assert.Error(t, err, "error expected") | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add copyright header