andreasgal/j2me.js — pull request #790 by mykmelez (2014-12-29 10:33:31+00:00)
Title: add FileConnection tests and fix various correctness issues

This branch adds a bunch of FileConnection tests from IBM's JSR-075 TCK, and it fixes some correctness issues that the tests uncovered.

In particular, it ensures that URLs to files include a "filesystem root," which isn't necessarily the "/" character (although it can be), i.e. "file:///" + (a filesystem root ending with a /) + (the path to the file).

It also ensures that internal representations of the file path and root are in the format that the implementation expects (in particular, that "fullPath" doesn't include the root).

The TCK tests still aren't completely passing, and I haven't yet added them to an automated test script, but you can run them manually via a URL like:

http://localhost:8000/index.html?main=com.ibm.tck.client.TestRunner&args=-noserver

And the remaining failures are mostly expected, in functionality that we haven't yet implemented, f.e.:

> com.ibm.tck.javax.microedition.io.file.FileConnection.AvailableSize#test0001 failed (Tests availableSize())
> com.ibm.tck.javax.microedition.io.file.FileConnection.AvailableSize#test0006 failed (Tests availableSize() on a non-existent file system)
> com.ibm.tck.javax.microedition.io.file.FileConnection.AvailableSize#test0007 failed (Tests availableSize() on a non-existent host)

So I think this in worth merging in its current state, to get the correctness fixes it contains, even though it'll take more effort to get the rest of the tests passing.