virote328 wrote
Alright, I believe I have finished the String class. It passes the "StringTest" without a problem.
The Given String.vm still allocates 3 fields. My version only does 2. I'm still puzzled as to what that third field is ^_^
This is related to the
Arrays don't know their own length? discussion.
One of the problems with the OS tests is that they can't test for error handling. For instance, if your String code doesn't catch attempts to append beyond the end of a string's allocated length, the test doesn't catch that.
Try adding this final test between the disposes in Main.Jack in StringTest:
do i.dispose();
let s = "123456";
do Output.printString("Should get error 17: ");
let s = s.appendChar(55);
do s.dispose();
[The three fields my String class has are Array pointer, current length and allocated length.]
--Mark