Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit dd90fbbd01a9248324e7be32a4444a192d3ce0d5 1 parent 75f1254
@rrthomas authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 tests-fcntl.lua
View
14 tests-fcntl.lua
@@ -1,10 +1,10 @@
-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)
@@ -12,7 +12,7 @@ function test_sane_getfl()
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)
Please sign in to comment.
Something went wrong with that request. Please try again.