We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d09c9d6 commit 37cf34bCopy full SHA for 37cf34b
regress/90-unget-textmode.lua
@@ -0,0 +1,28 @@
1
+#!/bin/sh
2
+_=[[
3
+ . "${0%%/*}/regress.sh"
4
+ exec runlua "$0" "$@"
5
+]]
6
+require"regress".export".*"
7
+
8
+local function test_with_mode(str, mode)
9
+ local c, s = socket.pair()
10
+ check(s:xwrite(str, "bn"))
11
+ local foo = c:xread(-99999, mode)
12
+ check(c:unget(foo, mode))
13
+ local bar = c:xread(-99999, mode)
14
+ check(foo == bar, "unget + read does not round trip")
15
+end
16
+local function test(str)
17
+ info("testing: %q", str)
18
+ test_with_mode(str, "t")
19
+ test_with_mode(str, "b")
20
21
22
+test'test'
23
+test'test\n'
24
+test'hi\r\nthere\nworld\r'
25
+test'\n\n'
26
+test'foo\r\r\n'
27
28
+say("OK")
0 commit comments