Add a mode to docgen to run the code samples in the documentation.

This alleviates copying them elsewhere to ensure they are not broken.

For the moment most of the "tests" fail due to various problems.  I fixed the the `library/tensor/basic.txt` file as a sample of the work that would have to be done to make this work for all the documentation.

If there is interest in this I can either work on it in this branch and merge when it's over or merge this right away to allow others to help.

When we get to a state where those tests pass we can think of adding such a test run to the buildbot and/or travis to check for broken examples and remove the test_tutorial files.