nus-cs2113-AY2324S2 / forum

2 stars 0 forks source link

failure in io redirection test #38

Closed anneleong closed 2 months ago

anneleong commented 2 months ago

my actual and expected text files seem to be the same but I am always failing text-ui-test when i enter ./runtest.bat

whyy :(

clarencepohh commented 2 months ago

It might possibly be due to your expected.txt file having Windows Line Separators while the macOS and nix GitHub runners produce nix line separators for actual.txt.

You can consider a few options:

  1. Use a macOS/Unix machine to generate another expected outputs file (perhaps label it expected-unix.txt?) and create another actual outputs file (actual-unix.txt?). In your .bat script (which runs on Windows) you should check diffs for actual.txt and expected.txt while your .sh script (unix and mac) should check diffs for actual-unix.txt and expected-unix.txt
  2. You should be able to achieve the same effect by writing a script that auto generates the required unix files with the correct line separators, but anytime you update your text I/O tests you have to run the script to generate the updated files.
  3. You can choose to delete the text I/O tests from your repo, as Prof has mentioned they are not needed.

Hope this helps!

okkhoy commented 2 months ago

can you PM the link to your failed build to me to check? @anneleong

ChinYanXu commented 2 months ago

Hello Anne. You could try replacing your newline characters with System.lineSeparator() . To my knowledge it is a system dependent newline and thus addresses the points clarencepohh raised about macOS and Windows using different newline characters. More information can be found here . Hope this helps!

webtjs commented 2 months ago

Apart from the points mentioned by clarencepohh and ChinYanXu, perhaps it could be due to some missing spaces or newlines? You could try using an online text comparison tool to see if there are any differences between your actual and expected text files.

anneleong commented 2 months ago

hello I worked the issue out with me team :) I used a ASCII text generator to generate a banner for our application, and there were extra spaces at the back of each string. For some reason the expected.txt trims the blank spaces thats why the tests were failing previously. Thanks for your help!