Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
Add tests for METADATA
Browse files Browse the repository at this point in the history
  • Loading branch information
aviks committed Jul 16, 2013
1 parent 1a015a2 commit f9c0832
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .test/METADATA.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const url_reg = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"
const gh_path_reg_git=r"^/(.*)?/(.*)?.git$"

for (pkg, versions) in Pkg2.Read.available()
url = (Pkg2.Read.url(pkg))
maxv = sort([keys(versions)...])[end]
m=match(url_reg, url)
assert (m != null, "Invalid url $url for package $(pkg). Should satisfy $url_reg")
host=m.captures[4]
assert (host!=nothing , "Invalid url $url for package $(pkg). Cannot extract host")
path=m.captures[5]
assert (path!=nothing , "Invalid url $url for package $(pkg). Cannot extract path")
scheme=m.captures[2]
assert ( ismatch (r"git", scheme) || ismatch (r"http", scheme), "Invalid url scheme $scheme for package $(pkg). Should be 'git' or 'http[s]'")
if ismatch(r"github\.com", host)
m2 = match(gh_path_reg_git, path)
assert (m2 != nothing , "Invalid github url pattern $url for package $(pkg). Should satisfy $gh_path_reg_git")
user=m2.captures[1]
repo=m2.captures[2]
sha1_file = "METADATA/$pkg/versions/$(maxv)/sha1"
@assert isfile(sha1_file)
end
end

@assert Pkg2.check_metadata()
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: cpp
compiler:
- clang
notifications:
email: false
before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo add-apt-repository ppa:staticfloat/julianightlies -y
- sudo apt-get update -qq -y
- sudo apt-get install libpcre3-dev julia -y
- git config --global user.name "Travis User"
- git config --global user.email "[email protected]"
script:
- cd ..
- ln -s METADATA.jl METADATA
- julia METADATA/.test/METADATA.jl

0 comments on commit f9c0832

Please sign in to comment.