diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/04-term_spec.lua | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/spec/04-term_spec.lua b/spec/04-term_spec.lua index ee4145a..487a0ce 100644 --- a/spec/04-term_spec.lua +++ b/spec/04-term_spec.lua | |||
@@ -106,21 +106,29 @@ describe("Terminal:", function() | |||
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | pending("getconsoleflags()", function() | 109 | describe("getconsoleflags()", function() |
110 | |||
111 | pending("returns the consoleflags, if called without flags", function() | ||
112 | print"1" | ||
113 | package.loaded["system"] = nil | ||
114 | package.loaded["system.core"] = nil | ||
115 | print"2" | ||
116 | local system = require "system" | ||
117 | print"3" | ||
118 | for k,v in pairs(system) do print(k,v) end | ||
119 | for k,v in pairs(debug.getinfo(system.isatty)) do print(k,v) end | ||
120 | 110 | ||
111 | win_it("returns the consoleflags #manual", function() | ||
121 | local flags, err = system.getconsoleflags(io.stdin) | 112 | local flags, err = system.getconsoleflags(io.stdin) |
122 | assert.is_nil(err) | 113 | assert.is_nil(err) |
123 | assert.is_integer(flags) | 114 | assert.is_userdata(flags) |
115 | assert.equals("bitflags:", tostring(flags):sub(1,9)) | ||
116 | end) | ||
117 | |||
118 | |||
119 | nix_it("returns the consoleflags, as value 0", function() | ||
120 | local flags, err = system.getconsoleflags(io.stdin) | ||
121 | assert.is_nil(err) | ||
122 | assert.is_userdata(flags) | ||
123 | assert.equals("bitflags:", tostring(flags):sub(1,9)) | ||
124 | assert.equals(0, flags:value()) | ||
125 | end) | ||
126 | |||
127 | |||
128 | it("returns an error if called with an invalid argument", function() | ||
129 | assert.has.error(function() | ||
130 | system.getconsoleflags("invalid") | ||
131 | end, "bad argument #1 to 'getconsoleflags' (FILE* expected, got string)") | ||
124 | end) | 132 | end) |
125 | 133 | ||
126 | end) | 134 | end) |