|
- package archlinux
-
- import (
- "bytes"
- "encoding/hex"
- "testing"
- )
-
- func TestReadSrcInfo(t *testing.T) {
- for _, test := range []struct {
- SrcInfo string
- Packages int
- MD5Sums int
- SHA256Sums int
- Depends int
- }{
- {testReadSrcInfoPwnypack, 1, 0, 1, 0},
- {testReadSrcInfoPythonPyJnius, 2, 1, 0, 2},
- } {
- build, err := ReadSrcInfo(bytes.NewBufferString(test.SrcInfo))
- if err != nil {
- t.Fatal(err)
- }
- t.Run(build.String(), func(t *testing.T) {
- if l := len(build.Packages); l != test.Packages {
- t.Fatalf(`expected %d packages, got %d`, test.Packages, l)
- }
- if l := len(build.MD5Sums); l != test.MD5Sums {
- t.Fatalf(`expected %d md5sums, got %d`, test.MD5Sums, l)
- }
- if l := len(build.SHA256Sums); l != test.SHA256Sums {
- t.Fatalf(`expected %d sha256sums, got %d`, test.SHA256Sums, l)
- }
- if len(build.MD5Sums) > 0 {
- t.Log("MD5", hex.EncodeToString(build.MD5Sums[0]))
- }
- if len(build.SHA256Sums) > 0 {
- t.Log("SHA256", hex.EncodeToString(build.SHA256Sums[0]))
- }
- t.Run("packages", func(t *testing.T) {
- for name, pkg := range build.Packages {
- t.Run(name, func(t *testing.T) {
- t.Log(pkg)
- if l := len(pkg.Depends); l != test.Depends {
- t.Fatalf(`expected %d dependencies, got %d`, test.Depends, l)
- }
- })
- }
- })
- })
- }
- }
-
- var (
- testReadSrcInfoPwnypack = `pkgbase = pwnypack
- pkgdesc = Official Certified Edible Dinosaurs CTF toolkit
- pkgver = 0.8.0
- pkgrel = 1
- url = https://github.com/edibledinos/pwnypack
- arch = any
- license = MIT
- makedepends = python
- depends = ipython
- depends = nasm
- depends = python
- depends = python-capstone
- depends = python-nose
- depends = python-six
- options = !emptydirs
- source = https://pypi.python.org/packages/0e/e5/7ea712cc0a2b37a1efc1ae314ae1c39438a16a70ac43e36f3d190911ce94/pwnypack-0.8.0.tar.gz
- sha256sums = 30d88155707a9b2a11aaf6bc8004dddc7c7545d8fa8f17b8d42de54e87a1b57d
-
- pkgname = pwnypack
-
- `
- testReadSrcInfoPythonPyJnius = `pkgbase = python-pyjnius
- pkgdesc = Python module to access Java class as Python class, using JNI.
- pkgver = 1.1.1
- pkgrel = 1
- url = https://github.com/kivy/pyjnius
- arch = any
- license = LGPL3
- source = pyjnius-1.1.1.tar.gz::https://github.com/kivy/pyjnius/tarball/1.1.1
- md5sums = 2d457e4761b27e6760cf54efb6201f17
-
- pkgname = python2-pyjnius
- depends = java-environment
- depends = python2
-
- pkgname = python-pyjnius
- depends = java-environment
- depends = python
- `
- )
|