aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-11-05 00:31:15 -0200
committerHisham Muhammad <hisham@gobolinux.org>2012-11-05 00:31:15 -0200
commitb11037885b303cc361f32758328ee24bf0d5d765 (patch)
tree690600d2535d5ec70eb4488638bd7035607cb563 /test
parent77b725b87d887c61f3475942e81a7d2e14e6ae7f (diff)
downloadluarocks-b11037885b303cc361f32758328ee24bf0d5d765.tar.gz
luarocks-b11037885b303cc361f32758328ee24bf0d5d765.tar.bz2
luarocks-b11037885b303cc361f32758328ee24bf0d5d765.zip
Remove old tests
Diffstat (limited to 'test')
-rwxr-xr-xtest/run_tests.sh75
-rw-r--r--test/test_deps.lua67
-rwxr-xr-xtest/test_require.lua25
3 files changed, 0 insertions, 167 deletions
diff --git a/test/run_tests.sh b/test/run_tests.sh
deleted file mode 100755
index 672b877e..00000000
--- a/test/run_tests.sh
+++ /dev/null
@@ -1,75 +0,0 @@
1#!/bin/bash
2
3if [ -e ./run_tests.sh ]
4then
5 cd ../src
6elif [ -d src ]
7then
8 cd src
9elif ! [ -d luarocks ]
10then
11 echo "Go to the src directory and run this."
12 exit 1
13fi
14
15if [ ! -d ../rocks ]
16then
17 echo "Downloading entire rocks repository for tests"
18 cd ..
19 cp -a ~/.cache/luarocks/rocks .
20 cd src
21fi
22
23rocks=(
24 `ls ../rocks/*.src.rock | grep -v luacom`
25)
26
27bin/luarocks-admin make-manifest ../rocks || exit 1
28
29[ "$1" ] && rocks=("$1")
30
31TRY() {
32 "$@" || {
33 echo "Failed running: $@"
34 exit 1
35 }
36}
37
38list_search() {
39 bin/luarocks list $name | grep $version
40}
41
42for rock in "${rocks[@]}"
43do
44 base=`basename $rock`
45 baserockspec=`basename $rock .rockspec`
46 basesrcrock=`basename $rock .src.rock`
47 if [ "$base" != "$baserockspec" ]
48 then
49 base=$baserockspec
50 name=`echo $base | sed 's/\(.*\)-[^-]*-[^-]*$/\1/'`
51 version=`echo $base | sed 's/.*-\([^-]*-[^-]*\)$/\1/'`
52 TRY bin/luarocks pack $rock
53 TRY bin/luarocks build $base.src.rock
54 TRY rm $base.src.rock
55 else
56 base=$basesrcrock
57 name=`echo $base | sed 's/\(.*\)-[^-]*-[^-]*$/\1/'`
58 version=`echo $base | sed 's/.*-\([^-]*-[^-]*\)$/\1/'`
59 TRY bin/luarocks build $rock
60 fi
61 TRY bin/luarocks pack $name $version
62 TRY bin/luarocks install $base.*.rock
63 TRY rm $base.*.rock
64 TRY list_search $name $version
65 bin/luarocks remove $name $version
66 # TODO: differentiate between error and dependency block.
67done
68
69if bin/luarocks install nonexistant | grep "No results"
70then echo "OK, got expected error."
71else exit 1
72fi
73
74TRY ../test/test_deps.lua
75TRY ../test/test_require.lua
diff --git a/test/test_deps.lua b/test/test_deps.lua
deleted file mode 100644
index 7236273c..00000000
--- a/test/test_deps.lua
+++ /dev/null
@@ -1,67 +0,0 @@
1#!/usr/bin/env lua
2
3deps = require "luarocks.deps"
4
5print(deps.show_dep(deps.parse_dep("lfs 2.1.9pre5"), true))
6print(deps.show_dep(deps.parse_dep("cgilua cvs-2"), true))
7print(deps.show_dep(deps.parse_dep("foobar 0.0.1beta"), true))
8print(deps.show_dep(deps.parse_dep("foobar 0.0.1a"), true))
9
10print(deps.show_dep(deps.parse_dep("foobar 1"), true))
11print(deps.show_dep(deps.parse_dep("foobar 2.0"), true))
12print(deps.show_dep(deps.parse_dep("foobar 3.5a4"), true))
13print(deps.show_dep(deps.parse_dep("foobar 1.1pre2"), true))
14print(deps.show_dep(deps.parse_dep("foobar 2.0-beta3"), true))
15print(deps.show_dep(deps.parse_dep("foobar 5.3"), true))
16print(deps.show_dep(deps.parse_dep("foobar 3.5rc2"), true))
17print(deps.show_dep(deps.parse_dep("foobar 4.19p"), true))
18
19print()
20comparisons = {
21-- first second eq le
22 {"Vista", "XP", false, true},
23 {"XP", "3.1", false, true},
24 {"1.0", "1.0", true, false},
25 {"2.2.10", "2.2-10", false, false},
26 {"2.2", "2.2-10", true, false},
27 {"1.0beta1", "1.0rc3", false, true},
28 {"2.0beta3", "2.0", false, true},
29 {"2.0beta", "2.0beta2", false, true},
30 {"2.0beta4", "2.0beta3", false, false},
31 {"2.1alpha1", "2.0beta1", false, false},
32 {"1.5p3", "1.5.1", false, true},
33 {"1.1.3", "1.1.3a", false, true},
34 {"1.5a100", "1.5b1", false, true},
35 {"2.0alpha100", "2.0beta1", false, true},
36 {"2.0.0beta3", "2.0beta2", false, false},
37 {"2.0-1", "2.0-2", false, true},
38 {"2.0-2", "2.0-1", false, false},
39 --[[
40 -- Corner cases I don't wish to handle by now.
41 {"2.0.0beta2", "2.0beta2", true, true},
42 {"2.0.0beta2", "2.0beta3", false, true},
43 ]]
44}
45
46local v1, v2
47
48err = false
49
50function result(test, expected)
51 if test == expected then
52 print(test, "OK")
53 else
54 print(test, "ERROR", deps.show_version(v1, true), deps.show_version(v2, true))
55 err = true
56 end
57end
58
59for _, c in ipairs(comparisons) do
60 v1, v2 = deps.parse_version(c[1]), deps.parse_version(c[2])
61 print(c[1].." == "..c[2].." ?")
62 result(v1 == v2, c[3])
63 print(c[1].." < "..c[2].." ?")
64 result(v1 < v2, c[4])
65end
66
67if err then os.exit(1) end
diff --git a/test/test_require.lua b/test/test_require.lua
deleted file mode 100755
index 2a652d29..00000000
--- a/test/test_require.lua
+++ /dev/null
@@ -1,25 +0,0 @@
1#!/usr/bin/env lua
2
3local luarocks = require("luarocks.require")
4
5luarocks.set_context("cgilua", "cvs-2")
6
7print(package.path)
8
9print(package.cpath)
10
11local socket = require("socket")
12if not socket then os.exit(1) end
13print(socket, socket._VERSION)
14
15local socket2 = require("socket")
16if not socket2 then os.exit(1) end
17print(socket2, socket2._VERSION)
18
19local mime = require("mime")
20if not mime then os.exit(1) end
21print(mime, mime._VERSION)
22
23local socket = require("lfs")
24if not lfs then os.exit(1) end
25print(lfs, lfs._VERSION)