|
3 | 3 | %
|
4 | 4 | % This TestComponent represents a single help(...) output, which is a
|
5 | 5 | % logical unit because variables defined earlier in the help text
|
6 |
| - % should carry over to the rest of it. A single DocTestCase is created |
7 |
| - % for each executable line of the test. A DocTestSuite represents more |
8 |
| - % than one DocTest. |
| 6 | + % should carry over to later parts. For instance, this example is |
| 7 | + % internally represented as two DocTestCases in one DocTest: |
| 8 | + % |
| 9 | + % >> x = 17; |
| 10 | + % >> x |
| 11 | + % x = 17 |
| 12 | + % |
| 13 | + % |
| 14 | + % This lets x be carried over from one to the next. |
| 15 | + % |
9 | 16 | %
|
10 | 17 | properties
|
11 | 18 | MethodName
|
@@ -53,9 +60,11 @@ function print(self, numLeadingBlanks)
|
53 | 60 | %
|
54 | 61 | % All the variables in this function begin with DOCTEST__.
|
55 | 62 | % That's because the namespace of this function and of the
|
56 |
| - % doctest that's being run are intermingled. This way, it's |
57 |
| - % very hard to unintentionally step on these internal |
58 |
| - % variables. It does make it hard to read, though... |
| 63 | + % doctest that's being run are intermingled. This is |
| 64 | + % unavoidable, as far as I can tell. With the DOCTEST__ prefix, |
| 65 | + % it's very hard to unintentionally step on these internal |
| 66 | + % variables when writing a doctest. It does make it hard to |
| 67 | + % read, though... |
59 | 68 | %
|
60 | 69 | if nargin < 2
|
61 | 70 | DOCTEST__monitor = CommandWindowTestRunDisplay();
|
@@ -110,11 +119,11 @@ function print(self, numLeadingBlanks)
|
110 | 119 | % They also sometimes backspace over things for no apparent reason. This
|
111 | 120 | % doctest recreates that condition.
|
112 | 121 | %
|
113 |
| - % >> sprintf('There is no dot here: .\x08') |
| 122 | + % >> sprintf('There is no letter x here: x\x08') |
114 | 123 | %
|
115 | 124 | % ans =
|
116 | 125 | %
|
117 |
| - % There is no dot here: |
| 126 | + % There is no letter x here: |
118 | 127 | %
|
119 | 128 | %
|
120 | 129 | % All of the doctests should pass, and they manipulate this function.
|
|
0 commit comments