[Ttssh2-commit] [6401] /I, /S, / V オプションのチェックを厳密にした。

svnno****@sourc***** svnno****@sourc*****
2016年 6月 10日 (金) 14:11:20 JST


Revision: 6401
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6401
Author:   doda
Date:     2016-06-10 14:11:20 +0900 (Fri, 10 Jun 2016)
Log Message:
-----------
/I, /S, /V オプションのチェックを厳密にした。
https://osdn.jp/ticket/browse.php?group_id=1412&tid=36342
[Ttssh2-devel 3001]

Modified Paths:
--------------
    trunk/teraterm/ttpmacro/ttmdlg.cpp

Added Paths:
-----------
    trunk/tests/macroparam.bat
    trunk/tests/macroparam.ttl

-------------- next part --------------
Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.cpp	2016-06-09 14:01:07 UTC (rev 6400)
+++ trunk/teraterm/ttpmacro/ttmdlg.cpp	2016-06-10 05:11:20 UTC (rev 6401)
@@ -84,13 +84,13 @@
 		if (_strnicmp(Temp,"/D=",3)==0) { // DDE option
 			strncpy_s(TopicName, sizeof(TopicName), &Temp[3], _TRUNCATE);
 		}
-		else if (_strnicmp(Temp,"/I",2)==0) {
+		else if (_stricmp(Temp, "/I")==0) {
 			*IOption = TRUE;
 		}
-		else if (_strnicmp(Temp,"/S",2)==0) {
+		else if (_stricmp(Temp, "/S")==0) {
 			SleepFlag = TRUE;
 		}
-		else if (_strnicmp(Temp,"/V",2)==0) {
+		else if (_stricmp(Temp, "/V")==0) {
 			*VOption = TRUE;
 		}
 		else {

Added: trunk/tests/macroparam.bat
===================================================================
--- trunk/tests/macroparam.bat	                        (rev 0)
+++ trunk/tests/macroparam.bat	2016-06-10 05:11:20 UTC (rev 6401)
@@ -0,0 +1,18 @@
+ @ echo off
+
+set TTMACRO=%~dp0\..\teraterm\Debug\ttpmacro.exe
+set MACROFILE=%~dpn0.ttl
+
+echo == test 1 ==
+"%TTMACRO%" "%MACROFILE%" /vxx /ixx /v /i test1
+if ERRORLEVEL 1 echo test 1 failed.
+
+echo == test 2 ==
+"%TTMACRO%" "%MACROFILE%" /v /i test2
+if ERRORLEVEL 1 echo test 2 failed.
+
+echo == test 3 ==
+"%TTMACRO%" "%MACROFILE%" test3 /vxx /ixx /v /i
+if ERRORLEVEL 1 echo test 3 failed.
+
+pause


Property changes on: trunk/tests/macroparam.bat
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tests/macroparam.ttl
===================================================================
--- trunk/tests/macroparam.ttl	                        (rev 0)
+++ trunk/tests/macroparam.ttl	2016-06-10 05:11:20 UTC (rev 6401)
@@ -0,0 +1,114 @@
+if paramcnt <= 1 goto error
+
+;
+; params[] \x96\xA2\x8E\xC0\x91\x95\x82̃o\x81[\x83W\x83\x87\x83\x93\x97p\x82\xCC params[] \x83G\x83~\x83\x85\x83\x8C\x81[\x83g
+;
+ifdefined params
+if result = 0 then
+	strdim params paramcnt+1
+
+	for i 1 paramcnt
+		sprintf2 cmd 'params[%d] = param%d' i i
+		execcmnd cmd
+	next
+endif
+
+testnum = 0
+
+for i 2 paramcnt
+	if testnum = 0 then
+		strmatch params[i] "test[1-9]"
+		if result then
+			testnum = i
+			break
+		endif
+	endif
+next
+
+if testnum then
+	sprintf2 cmd 'goto %s' params[testnum]
+	execcmnd cmd
+endif
+
+goto error
+
+
+:test1
+; ttpmacro.exe macrofile /vxx /ixx /v /i test1
+;
+; \x82Ƃ肠\x82\xA6\x82\xB8\x88ȉ\xBA\x82̂悤\x82ɉ\xF0\x8E߂\xB7\x82鎖\x82ɂ\xB7\x82\xE9
+;   paramcnt: 4
+;   param2: /vxx
+;   param3: /ixx
+;   param4: test1
+;
+if paramcnt <> 4 goto error
+strcompare param2 "/vxx"
+if result <> 0 goto error
+strcompare param3 "/ixx"
+if result <> 0 goto error
+strcompare param4 "test1"
+if result <> 0 goto error
+
+goto end
+
+:test2
+; ttpmacro.exe macrofile /v /i test2
+;
+; paramcnt: 2
+; param2: test2
+;
+if paramcnt <> 2 goto error
+strcompare param2 "test2"
+if result <> 0 goto error
+
+goto end
+
+:test3
+; ttpmacro.exe macrofile test3 /vxx /ixx /v /i
+;
+; \x82\xB1\x82\xEA\x82\xE0\x8Eb\x92\xE8\x82ňȉ\xBA\x82Ƃ\xB7\x82\xE9
+;   paramcnt: 4
+;   param2: test3
+;   param3: /vxx
+;   param4: /ixx
+;
+if paramcnt <> 4 goto error
+strcompare param2 "test3"
+if result <> 0 goto error
+strcompare param3 "/vxx"
+if result <> 0 goto error
+strcompare param4 "/ixx"
+if result <> 0 goto error
+
+goto end
+
+:test4
+; \x96\xA2\x8E\xC0\x91\x95
+goto end
+
+:test5
+; \x96\xA2\x8E\xC0\x91\x95
+goto end
+
+:test6
+; \x96\xA2\x8E\xC0\x91\x95
+goto end
+
+:test7
+; \x96\xA2\x8E\xC0\x91\x95
+goto end
+
+:test8
+; \x96\xA2\x8E\xC0\x91\x95
+goto end
+
+:test9
+; \x96\xA2\x8E\xC0\x91\x95
+goto end
+
+:error
+setexitcode 1
+
+:end
+end


Property changes on: trunk/tests/macroparam.ttl
___________________________________________________________________
Added: svn:executable
   + *



Ttssh2-commit メーリングリストの案内