summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Tmate.StdoutParser.vala26
-rw-r--r--tests/meson.build10
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/Tmate.StdoutParser.vala b/tests/Tmate.StdoutParser.vala
new file mode 100644
index 0000000..c619274
--- /dev/null
+++ b/tests/Tmate.StdoutParser.vala
@@ -0,0 +1,26 @@
+static int main()
+{
+ string test = """
+To connect to the session locally, run: tmate -S /tmp/tmate-1000/YSOfCR attach
+ssh.tmate.io lookup failure. Retrying in 2 seconds (non-recoverable failure in name resolution)
+Connecting to ssh.tmate.io...
+web session read only: https://tmate.io/t/ro-S9JDuEGmhJNJNELQMqpUvSYG7
+ssh session read only: ssh ro-S9JDuEGmhJNJNELQMqpUvSYG7@sgp1.tmate.io
+web session: https://tmate.io/t/NK5pSsnftmJuzsGxzjNdLJUCP
+ssh session: ssh NK5pSsnftmJuzsGxzjNdLJUCP@sgp1.tmate.io
+A mate has joined (160.202.145.245) -- 1 client currently connected
+Session shell restarted
+A mate has left (160.202.145.245) -- 0 client currently connected
+Error reading from channel: Socket error: Connection timed out
+Error connecting: Failed to connect: Network is unreachable
+Reconnecting...
+Session closed
+""";
+
+ foreach(var line in test.split("\n")) {
+ var token = (new Tmate.Stdout()).parse(line);
+ assert(token.class != Tmate.Stdout.TokenType.UNKNOWN);
+ print(@"$token\n");
+ }
+ return 0;
+}
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..60ca59e
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,10 @@
+foreach target : [
+ 'Tmate.StdoutParser'
+]
+ test('Test-@0@'.format(target),
+ executable('Test-@0@'.format(target),
+ files('@0@.vala'.format(target)) + tests,
+ dependencies: deps,
+ c_args: ['-include', 'config.h'],
+ ))
+endforeach