librazor/test.lua
author J. Ali Harlow <ali@juiblex.co.uk>
Sat Aug 23 11:13:48 2014 +0100 (2014-08-23)
changeset 440 48204dea0b9f
permissions -rw-r--r--
Remove INTLLIBS from librazor_la_LIBADD.

This partially reverts 611c84a3f4b4538a65d186050608c17adbf17770.
It's not clear what motivated the initial inclusion of INTLLIBS
here since the net effect is only seen in librazor.la and not
in razor.pc and librazor.la is not normally packaged. Certainly
neither the static nor the dynamic versions of librazor currently
use libintl. At best this would cause the linker to search a
static libintl for undefined symbols without finding any; at worse
it causes a static build of plover using librazor.la to fail if
no static version of libintl is installed.
     1 dofile("/testfile")
     2 assert(loadfile("/testfile"))
     3 assert(io.input("/testfile"))
     4 assert(io.output("/file1"))
     5 file = assert(io.open("/file1", "w"))
     6 assert(io.input(file))
     7 assert(io.output(file))
     8 file:write("Hello world\n")
     9 file:close()
    10 assert(io.input())
    11 assert(io.output())
    12 for line in assert(io.lines("/file1")) do
    13 	assert(line == "Hello world")
    14 end
    15 file, err = io.popen("/testfile", "r")
    16 if file == nil then
    17 	assert(string.find(err, " not supported") == 1)
    18 else
    19 	assert(file:read() == "Abracadabra!")
    20 	file:close();
    21 end
    22 assert(os.rename("/file1","/file2"))
    23 assert(os.remove("/file2"))
    24 assert(posix.mkdir("/testdir"))
    25 assert(posix.stat("/testdir"))
    26 assert(posix.chdir("/testdir"))
    27 assert(posix.getcwd() == "/testdir")
    28 assert(posix.mkdir("dir1"))
    29 assert(posix.link("/testdir/dir1", "/testdir/link", true))
    30 assert(posix.readlink("/testdir/link") == "/testdir/dir1")
    31 assert(posix.unlink("/testdir/link"))
    32 assert(posix.link("/testfile", "/testdir/magic", false))
    33 assert(posix.chmod("/testfile","a+x"))
    34 assert(posix.access("/testfile","x"))
    35 pid = posix.fork()
    36 if pid == 0 then
    37 	assert(posix.exec("/testfile"))
    38 else
    39 	posix.wait(pid)
    40 end
    41 assert(posix.chdir("/"))
    42 posix.setenv("PATH","/bin:/usr/bin:/testdir",true)
    43 pid = posix.fork()
    44 if pid == 0 then
    45 	assert(posix.execp("magic"))
    46 else
    47 	posix.wait(pid)
    48 end
    49 assert(posix.utime("/testfile"))
    50 assert(posix.pathconf("/testdir/magic"))
    51 assert(posix.mkfifo("/testdir/fifo"))
    52 assert(posix.dir())
    53 assert(posix.dir("/testdir"))
    54 assert(posix.files())
    55 assert(posix.files("/testdir"))
    56 for _,f in pairs(posix.glob("/testdir/*")) do
    57 	assert(string.find(f, "/testdir/") == 1)
    58 end
    59 assert(posix.rmdir("/testdir/dir1"))
    60 assert(posix.chown("/testfile",-1,-1))