oracc / nisaba

GNU General Public License v3.0
3 stars 0 forks source link

Process ATF validation results and prepare for VS Code's front end #24

Closed raquelalegre closed 3 years ago

raquelalegre commented 3 years ago

Doing some TDD, getting to know VS Code and do some further work on ATF validation. Related to #3. Fixes #32 . I have focused mainly on processing the server results for now, but more work will come on the server communication later.

raquelalegre commented 3 years ago

I have managed to process all the server results to create a validation errors dictionary (although I don't seem to be able to make the keys numbers and they end up converting themselves to string for some reason), and the oracc log that will be shown to the user in the VS Code console.

The tests are passing but they are only checking the validation errors dictionary. The oracc log assertion keeps on returning false because of this last new line character:

oracc_log = "Line 6: unknown block token: tableta.\nLine 44: o 4: translation uses undefined label.\nATF processor ox issued 2 warnings and 0 notices"

reference_oracc_log = "Line 6: unknown block token: tableta.\nLine 44: o 4: translation uses undefined label.\nATF processor ox issued 2 warnings and 0 notices\n"

Someone else had this problem, but it was their editor settings: https://github.com/nodejs/node-v0.x-archive/issues/218

I've checked and it doesn't seem like it was Atom or vim adding that line there, not sure if it's ReadFileSync or my editor doing something funny.

raquelalegre commented 3 years ago

Seems like windows doesn't like one of the string comparisons. Sigh.

raquelalegre commented 3 years ago

I've printed out the two strings that the test is comparing, and I have no idea why this is failing. See test log.

server_result.user_log:
"ATF validation returned no errors."

expected_user_log:
"ATF validation returned no errors."

🤷

raquelalegre commented 3 years ago

There's some end of line characters that windows doesn't like. Tests failed because:

      -["Line 6: unknown block token: tableta.\nLine 44: o 4: translation uses undefined label.\nATF processor ox issued 2 warnings and 0 notices"]
      +["Line 6: unknown block token: tableta.","Line 44: o 4: translation uses undefined label.","ATF processor ox issued 2 warnings and 0 notices"]

I give up for now. If anybody else has any ideas, that'd be great!

ageorgou commented 3 years ago

Is the issue that we need to use os.EOL for reading the file with expected results, but always use \n to split the actual results, since that's what the server sends?

Edit: And also use \n for breaking up the user log, since that's how we're building it in get_user_log (or maybe it's better to use os.EOL to build that too). So everything that comes from the server has \n, everything that we build is platform-specific (I don't know how that works with the gitattributes).

raquelalegre commented 3 years ago

Finally made the tests pass and the mock ServerResults work. I addressed some PR comments but not all! Looking into the rest of them now.

raquelalegre commented 3 years ago

Ready to merge unless someone else has anything against the idea of finally closing this PR :D

giordano commented 3 years ago

We should target master instead of validation-soap, right?

raquelalegre commented 3 years ago

Agreed!