I am learning some programming interview questions so I've coded FizzBuzz. I'm trying to comprare the output of my program to a known good output that's in a .txt file.
How do I check that node fizzbuzz.js
output is line by line equal to a expected-output.txt
file, or even diff
them?
I've tried this as suggested in the duplicate question:
diff -u expected-output.txt <(node fizzbuzz.js)
but diff
outputs nothing and never seems to quit until I ^C
. The program by itself runs fine, and so does diff -u expected-output.txt <(cat test.txt)
, it just doesn't seem to play well with node
for some reason.
node fizzbuzz.js > output.txt; diff -u expected-output.txt output.txt
work? If you can't get the process subst working, you might want to post another question about that (and include your version ofnode
and a full.js
script)console.log()
to print from my loop so maybe the process substitution never ends?