From b11037885b303cc361f32758328ee24bf0d5d765 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 5 Nov 2012 00:31:15 -0200 Subject: Remove old tests --- test/run_tests.sh | 75 --------------------------------------------------- test/test_deps.lua | 67 --------------------------------------------- test/test_require.lua | 25 ----------------- 3 files changed, 167 deletions(-) delete mode 100755 test/run_tests.sh delete mode 100644 test/test_deps.lua delete mode 100755 test/test_require.lua (limited to 'test') 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 @@ -#!/bin/bash - -if [ -e ./run_tests.sh ] -then - cd ../src -elif [ -d src ] -then - cd src -elif ! [ -d luarocks ] -then - echo "Go to the src directory and run this." - exit 1 -fi - -if [ ! -d ../rocks ] -then - echo "Downloading entire rocks repository for tests" - cd .. - cp -a ~/.cache/luarocks/rocks . - cd src -fi - -rocks=( - `ls ../rocks/*.src.rock | grep -v luacom` -) - -bin/luarocks-admin make-manifest ../rocks || exit 1 - -[ "$1" ] && rocks=("$1") - -TRY() { - "$@" || { - echo "Failed running: $@" - exit 1 - } -} - -list_search() { - bin/luarocks list $name | grep $version -} - -for rock in "${rocks[@]}" -do - base=`basename $rock` - baserockspec=`basename $rock .rockspec` - basesrcrock=`basename $rock .src.rock` - if [ "$base" != "$baserockspec" ] - then - base=$baserockspec - name=`echo $base | sed 's/\(.*\)-[^-]*-[^-]*$/\1/'` - version=`echo $base | sed 's/.*-\([^-]*-[^-]*\)$/\1/'` - TRY bin/luarocks pack $rock - TRY bin/luarocks build $base.src.rock - TRY rm $base.src.rock - else - base=$basesrcrock - name=`echo $base | sed 's/\(.*\)-[^-]*-[^-]*$/\1/'` - version=`echo $base | sed 's/.*-\([^-]*-[^-]*\)$/\1/'` - TRY bin/luarocks build $rock - fi - TRY bin/luarocks pack $name $version - TRY bin/luarocks install $base.*.rock - TRY rm $base.*.rock - TRY list_search $name $version - bin/luarocks remove $name $version - # TODO: differentiate between error and dependency block. -done - -if bin/luarocks install nonexistant | grep "No results" -then echo "OK, got expected error." -else exit 1 -fi - -TRY ../test/test_deps.lua -TRY ../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 @@ -#!/usr/bin/env lua - -deps = require "luarocks.deps" - -print(deps.show_dep(deps.parse_dep("lfs 2.1.9pre5"), true)) -print(deps.show_dep(deps.parse_dep("cgilua cvs-2"), true)) -print(deps.show_dep(deps.parse_dep("foobar 0.0.1beta"), true)) -print(deps.show_dep(deps.parse_dep("foobar 0.0.1a"), true)) - -print(deps.show_dep(deps.parse_dep("foobar 1"), true)) -print(deps.show_dep(deps.parse_dep("foobar 2.0"), true)) -print(deps.show_dep(deps.parse_dep("foobar 3.5a4"), true)) -print(deps.show_dep(deps.parse_dep("foobar 1.1pre2"), true)) -print(deps.show_dep(deps.parse_dep("foobar 2.0-beta3"), true)) -print(deps.show_dep(deps.parse_dep("foobar 5.3"), true)) -print(deps.show_dep(deps.parse_dep("foobar 3.5rc2"), true)) -print(deps.show_dep(deps.parse_dep("foobar 4.19p"), true)) - -print() -comparisons = { --- first second eq le - {"Vista", "XP", false, true}, - {"XP", "3.1", false, true}, - {"1.0", "1.0", true, false}, - {"2.2.10", "2.2-10", false, false}, - {"2.2", "2.2-10", true, false}, - {"1.0beta1", "1.0rc3", false, true}, - {"2.0beta3", "2.0", false, true}, - {"2.0beta", "2.0beta2", false, true}, - {"2.0beta4", "2.0beta3", false, false}, - {"2.1alpha1", "2.0beta1", false, false}, - {"1.5p3", "1.5.1", false, true}, - {"1.1.3", "1.1.3a", false, true}, - {"1.5a100", "1.5b1", false, true}, - {"2.0alpha100", "2.0beta1", false, true}, - {"2.0.0beta3", "2.0beta2", false, false}, - {"2.0-1", "2.0-2", false, true}, - {"2.0-2", "2.0-1", false, false}, - --[[ - -- Corner cases I don't wish to handle by now. - {"2.0.0beta2", "2.0beta2", true, true}, - {"2.0.0beta2", "2.0beta3", false, true}, - ]] -} - -local v1, v2 - -err = false - -function result(test, expected) - if test == expected then - print(test, "OK") - else - print(test, "ERROR", deps.show_version(v1, true), deps.show_version(v2, true)) - err = true - end -end - -for _, c in ipairs(comparisons) do - v1, v2 = deps.parse_version(c[1]), deps.parse_version(c[2]) - print(c[1].." == "..c[2].." ?") - result(v1 == v2, c[3]) - print(c[1].." < "..c[2].." ?") - result(v1 < v2, c[4]) -end - -if 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 @@ -#!/usr/bin/env lua - -local luarocks = require("luarocks.require") - -luarocks.set_context("cgilua", "cvs-2") - -print(package.path) - -print(package.cpath) - -local socket = require("socket") -if not socket then os.exit(1) end -print(socket, socket._VERSION) - -local socket2 = require("socket") -if not socket2 then os.exit(1) end -print(socket2, socket2._VERSION) - -local mime = require("mime") -if not mime then os.exit(1) end -print(mime, mime._VERSION) - -local socket = require("lfs") -if not lfs then os.exit(1) end -print(lfs, lfs._VERSION) -- cgit v1.2.3-55-g6feb