Skip to content

Commit fb0c2a4

Browse files
committed
Update testing.{txt,jax}
1 parent d56df9b commit fb0c2a4

File tree

2 files changed

+35
-27
lines changed

2 files changed

+35
-27
lines changed

doc/testing.jax

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*testing.txt* For Vim バージョン 9.1. Last change: 2024 Jun 17
1+
*testing.txt* For Vim バージョン 9.1. Last change: 2024 Jul 18
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -507,15 +507,16 @@ assert_equal({expected}, {actual} [, {msg}])
507507
ージを追加し、1 が返る。そうでなければ 0 が返る。
508508
|assert-return|
509509
エラーは "Expected {expected} but got {actual}" という形式で
510-
ある。{msg} が存在する場合は、その前に置かれる。
510+
ある。{msg} が存在する場合、スクリプトから実行される時にアサー
511+
トの場所と共に、その前に付加される。
511512

512513
暗黙的な変換は行われないため、文字列 "4" は数値 4 とは異なる。
513514
同様に、数値 4 は浮動小数点数 4.0 と異なる。ここでは
514515
'ignorecase' の値は使われず、大文字小文字は常に区別される。
515516
例: >
516-
assert_equal('foo', 'bar')
517-
< 以下の結果が|v:errors|に追加される:
518-
test.vim line 12: Expected 'foo' but got 'bar' ~
517+
call assert_equal('foo', 'bar', 'baz')
518+
< |v:errors| に以下を追加する:
519+
test.vim line 12: baz: Expected 'foo' but got 'bar' ~
519520

520521
|method| としても使用でき、ベースは第2引数として渡される: >
521522
mylist->assert_equal([1, 2, 3])
@@ -559,20 +560,20 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
559560
{error}が文字列である場合、最初に報告されたエラーの中から文字
560561
通り見つからなければならない。例えば、"E123:" の場合、多くの場
561562
合、これはコロンを含むエラーコードになる: >
562-
assert_fails('bad cmd', 'E987:')
563+
call assert_fails('bad cmd', 'E987:')
563564
<
564565
{error}が1つまたは2つの文字列をもつ |List| の場合、これらをパ
565566
ターンとして利用する。最初のパターンは、最初に報告されたエラー
566567
と照合される: >
567-
assert_fails('cmd', ['E987:.*expected bool'])
568+
call assert_fails('cmd', ['E987:.*expected bool'])
568569
<
569570
2番目のパターンが存在する場合、最後に報告されたエラーと照合さ
570571
れる。
571572
エラーが1つしかない場合は、両方のパターンが一致する必要がある。
572573
これを使用して、エラーが1つしかないことをチェックできる。
573574
最後のエラーのみにマッチさせるには、最初のエラーに空文字列を使
574575
用する: >
575-
assert_fails('cmd', ['', 'E987:'])
576+
call assert_fails('cmd', ['', 'E987:'])
576577
<
577578
{msg} が空の場合は利用されない。引数 {lnum} を渡す時にデフォル
578579
トメッセージを取得するにはこれを使うこと。
@@ -597,7 +598,8 @@ assert_false({actual} [, {msg}]) *assert_false()*
597598
|assert_equal()|と同様に、{actual}がfalseでない場合、|v:errors|
598599
にエラーメッセージを追加する。
599600
エラーは "Expected false but got {actual}" という形式である。
600-
{msg} が存在する場合は、その前に置かれる。
601+
{msg} が存在する場合、スクリプトから実行される時にアサートの場
602+
所と共に、その前に付加される。
601603
|assert-return| も参照。
602604

603605
ゼロである時、その値はfalseである。{actual}が数値でない場合、
@@ -622,7 +624,8 @@ assert_match({pattern}, {actual} [, {msg}])
622624
{pattern}{actual}と一致しない場合、|v:errors|にエラーメッセー
623625
ジが追加される。|assert-return| も参照。
624626
エラーは "Pattern {pattern} does not match {actual}" という形
625-
式である。{msg} が存在する場合は、その前に置かれる。
627+
式である。{msg} が存在する場合、スクリプトから実行される時にア
628+
サートの場所と共に、その前に付加される。
626629

627630
|=~|と同じように{pattern}が使われる: マッチングは 'magic'
628631
'cpoptions' の実際の値に関係なく、'magic' が設定され、
@@ -634,9 +637,9 @@ assert_match({pattern}, {actual} [, {msg}])
634637
部分一致で判定が行われる。}
635638

636639
例: >
637-
assert_match('^f.*o$', 'foobar')
638-
< これは |v:errors| に文字列が追加されることになる:
639-
test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
640+
call assert_match('^f.*o$', 'foobar')
641+
< 結果は |v:errors| に追加される文字列になる:
642+
test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
640643

641644
|method| としても使用できる: >
642645
getFile()->assert_match('foo.*')
@@ -691,7 +694,8 @@ assert_true({actual} [, {msg}]) *assert_true()*
691694
|assert-return| も参照。
692695
非ゼロである時、その値はTRUEである。{actual}が数値でない場合、
693696
テストが失敗する。
694-
{msg} が指定されると、デフォルトのメッセージの前に置かれる。
697+
{msg} が指定されると、スクリプトから実行される時にアサートの場
698+
所と共に、デフォルトのメッセージの前に付加される。
695699

696700
|method| としても使用できる: >
697701
GetResult()->assert_true()

en/testing.txt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*testing.txt* For Vim version 9.1. Last change: 2024 Jun 17
1+
*testing.txt* For Vim version 9.1. Last change: 2024 Jul 18
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -506,16 +506,17 @@ assert_equal({expected}, {actual} [, {msg}])
506506
added to |v:errors| and 1 is returned. Otherwise zero is
507507
returned. |assert-return|
508508
The error is in the form "Expected {expected} but got
509-
{actual}". When {msg} is present it is prefixed to that.
509+
{actual}". When {msg} is present it is prefixed to that,
510+
along with the location of the assert when run from a script.
510511

511512
There is no automatic conversion, the String "4" is different
512513
from the Number 4. And the number 4 is different from the
513514
Float 4.0. The value of 'ignorecase' is not used here, case
514515
always matters.
515516
Example: >
516-
assert_equal('foo', 'bar')
517-
< Will result in a string to be added to |v:errors|:
518-
test.vim line 12: Expected 'foo' but got 'bar' ~
517+
call assert_equal('foo', 'bar', 'baz')
518+
< Will add the following to |v:errors|:
519+
test.vim line 12: baz: Expected 'foo' but got 'bar' ~
519520

520521
Can also be used as a |method|, the base is passed as the
521522
second argument: >
@@ -561,19 +562,19 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
561562
When {error} is a string it must be found literally in the
562563
first reported error. Most often this will be the error code,
563564
including the colon, e.g. "E123:". >
564-
assert_fails('bad cmd', 'E987:')
565+
call assert_fails('bad cmd', 'E987:')
565566
<
566567
When {error} is a |List| with one or two strings, these are
567568
used as patterns. The first pattern is matched against the
568569
first reported error: >
569-
assert_fails('cmd', ['E987:.*expected bool'])
570+
call assert_fails('cmd', ['E987:.*expected bool'])
570571
< The second pattern, if present, is matched against the last
571572
reported error.
572573
If there is only one error then both patterns must match. This
573574
can be used to check that there is only one error.
574575
To only match the last error use an empty string for the first
575576
error: >
576-
assert_fails('cmd', ['', 'E987:'])
577+
call assert_fails('cmd', ['', 'E987:'])
577578
<
578579
If {msg} is empty then it is not used. Do this to get the
579580
default message when passing the {lnum} argument.
@@ -599,7 +600,8 @@ assert_false({actual} [, {msg}]) *assert_false()*
599600
When {actual} is not false an error message is added to
600601
|v:errors|, like with |assert_equal()|.
601602
The error is in the form "Expected False but got {actual}".
602-
When {msg} is present it is prepended to that.
603+
When {msg} is present it is prefixed to that, along with the
604+
location of the assert when run from a script.
603605
Also see |assert-return|.
604606

605607
A value is false when it is zero. When {actual} is not a
@@ -625,7 +627,8 @@ assert_match({pattern}, {actual} [, {msg}])
625627
When {pattern} does not match {actual} an error message is
626628
added to |v:errors|. Also see |assert-return|.
627629
The error is in the form "Pattern {pattern} does not match
628-
{actual}". When {msg} is present it is prefixed to that.
630+
{actual}". When {msg} is present it is prefixed to that,
631+
along with the location of the assert when run from a script.
629632

630633
{pattern} is used as with |=~|: The matching is always done
631634
like 'magic' was set and 'cpoptions' is empty, no matter what
@@ -636,9 +639,9 @@ assert_match({pattern}, {actual} [, {msg}])
636639
Use both to match the whole text.
637640

638641
Example: >
639-
assert_match('^f.*o$', 'foobar')
642+
call assert_match('^f.*o$', 'foobar')
640643
< Will result in a string to be added to |v:errors|:
641-
test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
644+
test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
642645

643646
Can also be used as a |method|: >
644647
getFile()->assert_match('foo.*')
@@ -693,7 +696,8 @@ assert_true({actual} [, {msg}]) *assert_true()*
693696
Also see |assert-return|.
694697
A value is TRUE when it is a non-zero number. When {actual}
695698
is not a number the assert fails.
696-
When {msg} is given it precedes the default message.
699+
When {msg} is given it is prefixed to the default message,
700+
along with the location of the assert when run from a script.
697701

698702
Can also be used as a |method|: >
699703
GetResult()->assert_true()

0 commit comments

Comments
 (0)