Skip to content

Commit

Permalink
Mention option to wrap tests in module.
Browse files Browse the repository at this point in the history
  • Loading branch information
twadleigh committed Jan 25, 2015
1 parent 4b51aef commit 7b3f6bb
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions doc/manual/workflow-tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ the following elements:

end

- **Put tests of your code in another file.** Create another file, say
``test_tmp.jl``, which begins with ::
- **Put your test code in another file.** Create another file, say
``tst.jl``, which begins with ::

import Tmp

Expand All @@ -42,14 +42,27 @@ the following elements:
``Tmp.`` to uses of names defined in your module. (You can lower that
cost by keeping your module name short.)

Alternatively, you can wrap the contents of your test file in a
module, as ::

module Tst
using Tmp

<scratch work>

end

The advantage is that you can now do :obj:`using` ``Tmp`` in your
test code and can therefore avoid prepending ``Tmp.`` everywhere.
The disadvantage is that code can no longer be selectively copied
to the REPL without some tweaking.

- **Lather. Rinse. Repeat.** Explore ideas at the ``julia`` command
prompt. Save good ideas in your ``test_tmp.jl`` file. Occasionally
prompt. Save good ideas in ``tst.jl``. Occasionally
restart the REPL, issuing ::

reload("Tmp")
include("test_tmp.jl")

editing these two files as you go.
include("tst.jl")

Simplify initialization
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 7b3f6bb

Please sign in to comment.