Permalink
Browse files

tests-fcntl.lua: make them work with Lua 5.2.

  • Loading branch information...
1 parent 75f1254 commit dd90fbbd01a9248324e7be32a4444a192d3ce0d5 @rrthomas committed Mar 25, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 tests-fcntl.lua
View
@@ -1,18 +1,18 @@
-require "lunit"
-require "bit"
+lunit = require "lunit"
+bit = bit32 or require "bit"
module("test_fcntl", lunit.testcase, package.seeall)
function test_sane_getfl()
- require "posix"
+ local posix = require "posix"
local fd = posix.fileno(io.stdin)
local flags = posix.fcntl(fd, posix.F_GETFL)
assert_number(flags)
assert(flags >= 0, "returned flags are negative")
end
function test_setfl_works()
- require "posix"
+ local posix = require "posix"
local fd = posix.fileno(io.stdin)
local flags = posix.fcntl(fd, posix.F_GETFL)
-- Remove NONBLOCK, if any
@@ -25,19 +25,19 @@ function test_setfl_works()
end
function test_negative_fd_fails()
- require "posix"
+ local posix = require "posix"
ret, msg, errno = posix.fcntl(-7, posix.F_GETFL)
assert_nil(ret)
end
function test_nonopen_fd_fails()
- require "posix"
+ local posix = require "posix"
ret, msg, errno = posix.fcntl(666, posix.F_GETFL)
assert_nil(ret)
end
function test_wrong_userdata_fails()
- require "posix"
+ local posix = require "posix"
assert_error("Passing wrong type instead of fd does not bomb out",
function()
posix.fcntl("foobar", posix.F_GETFL)

0 comments on commit dd90fbb

Please sign in to comment.