Commit Graph

16 Commits

Author SHA1 Message Date
Simon Heimberg
6ae309cc92 tests: glob match has a glob character for not getting a warning on windows
When / matches on / on windows, and there is no other glob character, this
results in a warning. Avoid this by using an other glob character.
2014-02-14 00:36:44 +01:00
Mads Kiilerich
0b618576fd test-run-tests.t: fix wrong test case for cr handling on Windows
An incorrect and failing test case was introduced in a55b74d8de3a.
2012-10-18 00:33:26 +02:00
Mads Kiilerich
1aa09f180d run-tests: make it possible to combine (esc) with (glob) and (re)
This makes it possible to combine the annotations ... if done in the right
order.
2012-10-14 18:30:42 +02:00
Mads Kiilerich
ffdf739c4d run-tests: alternative way of handling \r on Windows
After d5471ad04cf6 all \r was stripped from output on Windows, and the places
where a \r explicitly was expected it was accepted that it was missing. Ugly
hack.

Instead we now accept that an extra \r might appear at the end of lines on
Windows. That is more to the point and less ugly.
2012-10-15 02:33:12 +02:00
Mads Kiilerich
9cddfd19ab check-code: fix check for trailing whitespace on sh command lines
The $ has been without necessary escaping since introduced in c4ecbbd282fe.
2012-08-08 18:10:16 +02:00
Adrian Buehlmann
d75f30dfcb test-run-tests: add tests for "#if no-false" and no-true 2012-06-11 14:09:35 +02:00
Adrian Buehlmann
6e5f4815b5 tests/hghave: implement #if true / #if false
For unconditionally testing / skipping a section. Useful for testing the test
infrastructure in test-run-tests.t and for debugging/developing tests.
2012-06-08 15:11:05 +02:00
Mads Kiilerich
7d411da706 tests: introduce c-style conditional sections in .t tests
This makes it possible to have conditional sections like:

#if windows
  $ echo foo
  foo
#else
  $ echo bar
  bar
#endif

The directives and skipped sections are treated like comments, so don't
interleave them with commands and their output.

The parameters to #if are evaluated while preparing the test by passing them
over to hghave. Requirements can thus be negated with 'no-' prefix, and
multiple requirements must all be true to return true.
2012-06-01 02:25:12 +02:00
Mads Kiilerich
bec2d3c22e tests: don't rely on 'false' exit code in test-run-tests.t
On Solaris:
$ sh -c 'false ; echo $?'
255
2012-01-27 03:00:32 +01:00
Matt Mackall
17d82e7fd5 run-tests: replace inline python handling with more native scheme
Normally changes in tests are reported like this in diffs:

   $ cat foo
-  a
+  b

Using -i mode lets us update tests when the new results are correct
and/or populate tests with their output.

But with the standard doctest framework, inline Python sections in
tests changes instead result in a big failure report that's unhelpful.
So here, we replace the doctest calls with a simple compile/eval loop.
2011-11-07 13:46:41 -06:00
Idan Kamara
2f9b12fec9 tests: add basic tests for doctest syntax 2011-10-13 17:54:38 +02:00
Mads Kiilerich
8c125f4b6b tests: (no-eol) markup for command output without trailing LF
Output chunks without a trailing LF will now work but get (no-eol) appended.

This change mostly moves code around so we can handle that an output line
starts with data from previous command, followed by salt and the next command.
2010-11-08 01:35:40 +01:00
Mads Kiilerich
ea28311c45 tests: avoid checking the exitcode of false
Solaris false returns 255 instead of 1, so we remove one unneeded instance and
replaces another with (exit 1) as suggested by Brodie Rao.
2010-09-25 21:52:17 +02:00
Matt Mackall
430e769c2b tests: various fixes for new unified test pattern format 2010-09-22 18:20:47 -05:00
Brodie Rao
b5fe0d906e tests: add glob matching for unified tests
This adds a " (glob)" marker that works like a simpler version of
(re): "*" is converted to ".*", and "?" is converted to ".".

Both special characters can be escaped using "\", and the backslash
itself can be escaped as well.

Other glob-style syntax, like "**", "[chars]", or "[!chars]", isn't
supported.
2010-09-22 16:06:02 -05:00
Brodie Rao
7d7d96bd74 tests: require regexes in unified tests to be marked with " (re)"
Consider this test:

  $ hg glog --template '{rev}:{node|short} "{desc}"\n'
  @  2:20c4f79fd7ac "3"
  |
  | o  1:38f24201dcab "2"
  |/
  o  0:2a18120dc1c9 "1"

Because each line beginning with "|" can be compiled as a regular
expression (equivalent to ".*|"), they will match any output.

Similarly:

  $ echo foo


The blank output line can be compiled as a regular expression and will
also match any output.

With this patch, none of the above output lines will be matched as
regular expressions. A line must end in " (re)" in order to be matched
as one.

Lines are still matched literally first, so the following will pass:

  $ echo 'foo (re)'
  foo (re)
2010-09-22 16:06:00 -05:00