Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
atools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo
atools
Commits
ca7e1b36
Commit
ca7e1b36
authored
May 21, 2019
by
Kevin Daudt
Committed by
maxice8
May 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: add more test coverage
parent
ec2c9291
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
136 additions
and
0 deletions
+136
-0
tests/apkbuild-lint.bats
tests/apkbuild-lint.bats
+136
-0
No files found.
tests/apkbuild-lint.bats
View file @
ca7e1b36
...
...
@@ -117,3 +117,139 @@ assert_match() {
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "variable.*empty"
}
@test 'custom global variables should start with an underscore' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
foo=
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "prefix.*_"
}
@test 'indentation should be with tabs' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
build() {
foo
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "indent.*tabs"
}
@test 'trailing whitespace should be removed' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
build() {
foo
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "trailing whitespace"
}
@test 'prefer \$() to backticks' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
build() {
local a=`echo test`
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "instead of backticks"
}
@test 'function keyword should not be used' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
function build() {
foo
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "function keyword"
}
@test 'no space between function name and parenthesis' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
build () {
foo
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "before function parenthesis"
}
@test 'one space after function parenthesis' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
build() {
foo
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "after function parenthesis"
}
@test 'opening brace for function should be on the same line' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
build()
{
foo
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "newline before function"
}
@test 'cd to builddir dir without cd to other dir can be removed' {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
build() {
cd "$builddir"
foo
}
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "builddir.*can be removed"
}
# vim: noexpandtab
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment