Source

SageTeX / test

#!/usr/bin/env bash

# this runs Sage on the generated .sage files to see if they work ok
# this is basically the spkg-check file

function checkdotsage
{
    sage $1.sage
    if [ $? -ne 0 ]
    then
        echo "Error running Sage on $1.sage!"
        exit 1
    else
        echo "No problem that spkg-check can detect running Sage on $1.sage."
    fi
}

latex example.tex > /dev/null
checkdotsage example

latex sagetexpackage.dtx > /dev/null
checkdotsage sagetexpackage

# if we get here, we assume the .sage files are good, and exit successfully
exit 0