Blame specs/posix_stdio_spec.yaml
|
Packit |
437b5e |
specify posix.stdio:
|
|
Packit |
437b5e |
- before:
|
|
Packit |
437b5e |
stdio = require "posix.stdio"
|
|
Packit |
437b5e |
|
|
Packit |
437b5e |
|
|
Packit |
437b5e |
- describe fdopen:
|
|
Packit |
437b5e |
- before:
|
|
Packit |
437b5e |
fdopen = stdio.fdopen
|
|
Packit |
437b5e |
unistd = require "posix.unistd"
|
|
Packit |
437b5e |
STDOUT_FILENO = unistd.STDOUT_FILENO
|
|
Packit |
437b5e |
f = fdopen (STDOUT_FILENO, "w")
|
|
Packit |
437b5e |
|
|
Packit |
437b5e |
- context with bad arguments:
|
|
Packit |
437b5e |
badargs.diagnose (fdopen, "(int,string)")
|
|
Packit |
437b5e |
|
|
Packit |
437b5e |
- it duplicates a stream:
|
|
Packit |
437b5e |
expect (type (f)).to_be "userdata"
|
|
Packit |
437b5e |
|
|
Packit |
437b5e |
- it writes to the duplicated stream:
|
|
Packit |
437b5e |
-- Lua 5.1 file.write returns true; > 5.1 returns file handle
|
|
Packit |
437b5e |
expect (f:write ("writing to fdopen(stdout)\n")).not_to_be (nil)
|