Browse Subversion Repository
Contents of /branches/ttcomtester/tests/#36405-strreplace.ttl
Parent Directory
| Revision Log
Revision 10521 -
( show annotations)
( download)
Fri Jan 20 16:03:38 2023 UTC
(14 months, 3 weeks ago)
by zmatsuo
File size: 1542 byte(s)
add communication test tool
| 1 |
error_count = 0 |
| 2 |
|
| 3 |
orgstr = "1234[test]1234" |
| 4 |
str = orgstr |
| 5 |
|
| 6 |
; "[" は正規表現として正しくないのでエラーとなるべき |
| 7 |
strreplace str 1 "[" "(" |
| 8 |
repl_result = result |
| 9 |
|
| 10 |
strcompare str orgstr |
| 11 |
compare_result = result |
| 12 |
|
| 13 |
if repl_result == 1 then |
| 14 |
; 置換成功 -- 正しくない動作 |
| 15 |
error_count = error_count + 1 |
| 16 |
msg = "エラーとなるべき検索条件でエラーになりませんでした" |
| 17 |
if compare_result <> 0 then |
| 18 |
; 文字列が壊された |
| 19 |
error_count = error_count + 1 |
| 20 |
strconcat msg #13#10"元文字列も壊れています" |
| 21 |
endif |
| 22 |
messagebox msg "エラー" |
| 23 |
|
| 24 |
elseif repl_result == 0 then |
| 25 |
; not found (暫定修正時の動作) |
| 26 |
error_count = error_count + 1 |
| 27 |
msg = "検索結果が not found となりました" |
| 28 |
if compare_result <> 0 then |
| 29 |
; 文字列が壊された |
| 30 |
error_count = error_count + 1 |
| 31 |
strconcat msg #13#10"元文字列も壊れています" |
| 32 |
endif |
| 33 |
messagebox msg "エラー" |
| 34 |
|
| 35 |
elseif repl_result == -1 then |
| 36 |
; strreplace がエラーとなった -- 正しい動作 |
| 37 |
if compare_result <> 0 then |
| 38 |
; 文字列が壊された |
| 39 |
error_count = error_count + 1 |
| 40 |
messagebox "文字列が壊れています" "エラー" |
| 41 |
endif |
| 42 |
else |
| 43 |
; strreplace の result が異常 |
| 44 |
error_count = error_count + 1 |
| 45 |
sprintf2 msg "strreplaceの返り値が異常です(%d)" repl_result |
| 46 |
if compare_result <> 0 then |
| 47 |
; 文字列が壊された |
| 48 |
error_count = error_count + 1 |
| 49 |
strconcat msg #13#10"元文字列も壊れています" |
| 50 |
endif |
| 51 |
messagebox msg "エラー" |
| 52 |
endif |
| 53 |
|
| 54 |
if error_count == 0 then |
| 55 |
messagebox "正常終了" "結果" |
| 56 |
else |
| 57 |
sprintf2 msg "%d 件のエラーが発生しました" error_count |
| 58 |
messagebox msg "結果" |
| 59 |
setexitcode 1 |
| 60 |
endif |
| 61 |
|
| 62 |
end |
|