Permalink
Browse files

Add test for nqp::x_posixerrno and pir::const::POSIX_*

  • Loading branch information...
1 parent 42611bf commit 9918925b79237a3a7c91a5dc8cbb150d42fe5146 @hoelzro hoelzro committed Mar 18, 2013
Showing with 26 additions and 0 deletions.
  1. +26 −0 t/nqp/67-errno.t
View
@@ -0,0 +1,26 @@
+plan(3);
+
+sub mkdir($filename) {
+ pir::new__PS('OS').mkdir($filename, 0o777);
+ return True;
+ CATCH {
+ return False;
+ }
+}
+
+sub rmdir($filename) {
+ pir::new__PS('OS').rmdir($filename);
+ return True;
+ CATCH {
+ return False;
+ }
+}
+
+my $test-dir := 'errno-test-dir';
+
+rmdir($test-dir);
+ok(mkdir($test-dir) eq True, 'mkdir should succeed');
+ok(mkdir($test-dir) eq False, 'mkdir of an existing directory should fail');
+ok(nqp::x_posixerrno() == pir::const::POSIX_EEXIST, 'errno should be equal to EEXIST');
+
+rmdir($test-dir);

0 comments on commit 9918925

Please sign in to comment.