summaryrefslogtreecommitdiff
path: root/test/dumb_tcp_client.py
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-02 23:49:47 +0100
committerw0rp <devw0rp@gmail.com>2018-07-02 23:49:47 +0100
commit01c68fedd63ccb9360134dba1cd2c722bc9f7006 (patch)
tree086ad02a035a20acc12cfe2a693cb8c9db901466 /test/dumb_tcp_client.py
parentb637b35ea89a5a756477b9e2545a2f36299ac5fa (diff)
downloadale-01c68fedd63ccb9360134dba1cd2c722bc9f7006.zip
#830 Implement a socket wrapper API for use with LSP connections
Diffstat (limited to 'test/dumb_tcp_client.py')
-rw-r--r--test/dumb_tcp_client.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/dumb_tcp_client.py b/test/dumb_tcp_client.py
new file mode 100644
index 00000000..3a728b02
--- /dev/null
+++ b/test/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()