Esempio n. 1
0
  public void testUnicodeChars() throws Exception {
    File file = new File("unicodeáéíóú");
    if (file.exists()) {
      if (!file.delete()) {
        fail("Unable to delete file: " + file);
      }
    }
    try {
      if (!file.mkdirs()) {
        fail("Unable to create directory: " + file);
      }
      Ruby runtime;
      RubyInstanceConfig.nativeEnabled = false;
      runtime = Ruby.newInstance();

      JRubyFile rubyFile = RubyFile.file(RubyString.newString(runtime, file.getAbsolutePath()));
      assertTrue(rubyFile.exists());
      assertTrue(file.exists());
      assertTrue(file.isDirectory());
      try {
        assertTrue(runtime.getPosix().stat(rubyFile.getAbsolutePath()).isDirectory());
      } catch (Exception e) {
        throw new RuntimeException("Expecting posix layer to work properly", e);
      }
    } finally {
      if (file.exists()) {
        file.delete();
      }
    }
  }