I'd like to start writing some unit tests for my Mathematica programs and control everything from the command line with some Makefiles.
It seems like Mathematica can be run from the command line but I can't see any basic instructions on getting started with doing this on Mac OS X — has anyone done this before?
Update:
Creating a test file like this:
Print["hello"]; x := 1; y = x+1; z = y+1; Print["y="ToString@y]; Print["z="ToString@z]; Quit[];
And running it with
/Applications/Mathematica.app/Contents/MacOS/MathKernel -noprompt < test.m
is the closest I can get to some sort of batch processing. The output looks ugly, though; newlines are added for every line of the script!
"hello" "y=2" "z=3"
Is this the closest thing I can get to a script that can still output information to the console output? I'm only using Mathematica 6, but I hope that doesn't make a difference.