Repository navigation
文字列検索の今の動きをテストで固定する - #2869
Merged
berryzplus merged 1 commit intoNov 17, 2026
Merged
文字列検索の今の動きをテストで固定する#2869
Conversation
|
berryzplus
approved these changes
Nov 17, 2026
| ASSERT_THAT(SetKey(L"aBc", false, false, false), IsTrue()); | ||
| EXPECT_THAT(FindAll(L"ABC xabCx Abc"), ElementsAre(0, 3, 5, 3, 10, 3)); | ||
| ASSERT_THAT(SetKey(L"aBcDeF", false, false, false), IsTrue()); | ||
| EXPECT_THAT(FindAll(L"ABCDEF xabcdefx AbCdEf"), ElementsAre(0, 6, 8, 6, 16, 6)); |
Contributor
There was a problem hiding this comment.
コピペで作ってると思うんですが
ASSERT_ 失敗したときテストケース実行は終了する
EXPECT_ 失敗してもテストケースは続行する
という違いがあるので、あとでニャーニャー言う民が出るかもです。
Contributor
Author
There was a problem hiding this comment.
ご確認ありがとうございます。
次の対応で、修正してしまいます。
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



refs #2865
文字列検索(
CSearchAgent::SearchString()・CSearchStringPattern::SetPattern())を作り直す前に、今の動きをテストで固定します。#2865 の対応 1 です。テストを足すだけで、製品コードは変えていません。
変更内容
test-csearchagent.cppにテストを 13 件足します。Grep・Grep 置換が使うCLineMatchFinderを通してSearchString()を呼びます。今の
SearchString()にはループが 2 つあるので(「区別しない、または 6 文字以上」と「区別する、かつ 5 文字以下」)、短い検索語と長い検索語の組で両方を通します。StringMatchCaseShortKeyStringMatchCaseLongKeyStringIgnoreCaseShortAndLongKeyStringMatchCaseRejectsDifferentCaseStringKeyLongerThanLineOrEmptyStringStartNearLineEndStringSingleCharKeyStringCharsSharingSkipTableSlotStringLineWithoutTerminatorSetPatternAgainChangesCaseSetPatternAgainChangesKindSetPatternRemembersKeyWhenCompileFailsCompileRegexpTest.EmptyReplacePatternStringLineWithoutTerminatorは、後で「行の 1 つ先を読まない」形に直したときに、結果が変わらないことを見るためのものです。今のコードは一致しなかった候補の 1 つ先の文字を読むので、長い文字列の前半を行として渡し、読む先が文字列リテラルの中に収まるようにしています。
テスト
CLineMatchFinderTest.*・CompileRegexpTest.*の 31 件が成功(足した 13 件を含む)