Simplify and centralize temporary file creation

Change-Id: I6674783e7707d66efea05d52381114779f3a64ee
diff --git a/t/test.t b/t/test.t
new file mode 100644
index 0000000..5b6fbe1
--- /dev/null
+++ b/t/test.t
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use Test::More;
+
+use FindBin;
+BEGIN {
+  unshift @INC, "$FindBin::Bin/../lib";
+};
+
+use_ok('Test::KorAP::XML::TEI','korap_tempfile');
+
+my ($fh, $filename) = korap_tempfile('test');
+ok($fh, 'Filehandle created');
+ok($filename, 'Filename returned');
+close($fh);
+
+like($filename, qr!KorAP-XML-TEI_test_.+?\.tmp$!, 'Filename pattern');
+
+($fh, $filename) = korap_tempfile();
+ok($fh, 'Filehandle created');
+ok($filename, 'Filename returned');
+close($fh);
+
+like($filename, qr!KorAP-XML-TEI_.+?\.tmp$!, 'Filename pattern');
+
+done_testing;