ZaDarkSide / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

tests located in a directory with non-ASCII name are always failed #395

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a directory whose name contains non-ASCII characters (I used cyrillic 
- 'мой-тест')
2. copy a sample test and a config file to this directory
3. run the config file

What is the expected output? What do you see instead?

I'm getting following:
java.lang.RuntimeException: Impossible to read file: 
/home/segrey/WebstormProjects/untitled12/мой-тест/test.js
    at com.google.jstestdriver.SimpleFileReader.readFile(SimpleFileReader.java:50)
    at com.google.jstestdriver.FileInfo.loadFile(FileInfo.java:203)
    at com.google.jstestdriver.ProcessingFileLoader.loadFiles(ProcessingFileLoader.java:61)
    at com.google.jstestdriver.model.JstdTestCaseDelta.loadFiles(JstdTestCaseDelta.java:59)
    at com.google.jstestdriver.FileUploader.uploadToServer(FileUploader.java:218)
    at com.google.jstestdriver.action.UploadAction.run(UploadAction.java:39)
    at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:81)
    at com.google.jstestdriver.embedded.JsTestDriverImpl.runConfigurationWithFlags(JsTestDriverImpl.java:342)
    at com.google.jstestdriver.embedded.JsTestDriverImpl.runConfiguration(JsTestDriverImpl.java:233)
    at com.google.jstestdriver.idea.TestRunner.runTests(TestRunner.java:190)
    at com.google.jstestdriver.idea.TestRunner.executeTests(TestRunner.java:115)
    at com.google.jstestdriver.idea.TestRunner.executeConfig(TestRunner.java:106)
    at com.google.jstestdriver.idea.TestRunner.executeAll(TestRunner.java:88)
    at com.google.jstestdriver.idea.TestRunner.main(TestRunner.java:312)
Caused by: java.io.FileNotFoundException: 
/home/segrey/WebstormProjects/untitled12/мой-тест/test.js 
(No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at java.io.FileInputStream.<init>(FileInputStream.java:79)
    at com.google.jstestdriver.SimpleFileReader.readFile(SimpleFileReader.java:34)
    ... 13 more

Proper path is 
'/home/segrey/WebstormProjects/untitled12/мой-тест/test.js'.

Please use labels and text to provide additional information.
It seems a browser returns malformed path.

Original issue reported on code.google.com by Sergey.S...@gmail.com on 25 Jul 2012 at 3:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I use chinese in file path and meet the same problem with you.
JStestdriver use bytestream to read file path, you can upgrade JStestdriver by 
yourself.
Try the below method.

1.find method toString(InputStream inputStream) in the source file 
com.google.jstestdriver.HttpServer.java
2.change bytestream to charstream

see below.

private String toString(InputStream inputStream) throws IOException {
//      StringBuilder sb = new StringBuilder();
//      int ch;
//
//      while ((ch = inputStream.read()) != -1) {
//        sb.append((char) ch);
//      }
//      inputStream.close();
//    
//      return sb.toString();
    BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, new StandardCharsets().charsetForName("UTF-8")));
    StringBuffer buffer = new StringBuffer();
    int line;
    while ((line = in.read()) != -1){
      buffer.append((char)line);
    }
    inputStream.close();

    return buffer.toString();
  }

Original comment by qq807215...@gmail.com on 20 Sep 2013 at 10:45

GoogleCodeExporter commented 8 years ago
It's already fixed in master branch: 
https://code.google.com/p/js-test-driver/source/diff?spec=svn170a4754abc99c3217d
349d55592b86a89000efd&r=170a4754abc99c3217d349d55592b86a89000efd&format=side&pat
h=/JsTestDriver/src/com/google/jstestdriver/HttpServer.java&old_path=/JsTestDriv
er/src/com/google/jstestdriver/HttpServer.java&old=33995a6decf4f728d5f4b76cb93a0
8137f1fd0c3

But there was no releases yet with this change included.

Original comment by Sergey.S...@gmail.com on 20 Sep 2013 at 11:11