summaryrefslogtreecommitdiff
path: root/test/script/dumb_tcp_client.py
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2021-03-20 22:11:22 +0000
committerw0rp <devw0rp@gmail.com>2021-03-20 22:11:42 +0000
commitb1d833417bcb57e265e0d01df07b28f463529d4b (patch)
tree11421aeca89127b0cc9417f8ff4cb0d725199f49 /test/script/dumb_tcp_client.py
parent3838ae118d8f05fa1b1be7952a1c8aa3055d6728 (diff)
downloadale-b1d833417bcb57e265e0d01df07b28f463529d4b.zip
#3633 - Put all dummy test files in test/test-files
Diffstat (limited to 'test/script/dumb_tcp_client.py')
-rw-r--r--test/script/dumb_tcp_client.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/script/dumb_tcp_client.py b/test/script/dumb_tcp_client.py
new file mode 100644
index 00000000..3a728b02
--- /dev/null
+++ b/test/script/dumb_tcp_client.py
@@ -0,0 +1,33 @@
+"""
+This is just a script for testing that the dumb TCP server actually works
+correctly, for verifying that problems with tests are in Vim. Pass the
+same port number given to the test server to check that it's working.
+"""
+import socket
+import sys
+
+
+def main():
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ result = sock.connect_ex(('127.0.0.1', int(sys.argv[1])))
+
+ if result:
+ sock.close()
+ sys.exit("Couldn't connect to the socket!")
+
+ data_sent = 'x' * 1024
+
+ sock.send(data_sent)
+ data_received = sock.recv(1024)
+
+ if data_sent != data_received:
+ sock.close()
+ sys.exit("Data sent didn't match data received.")
+
+ sock.close()
+
+ print("Everything was just fine.")
+
+
+if __name__ == "__main__":
+ main()