Run no evil

Former Member
Former Member
Trying to run Run no evil. I wrote a simple test case based on (I think) the instructions:

(:test)
function testTR1Data( logger )
{
System.println( "What?" );
TR1Data.refresh();
}

But all I get is this - no sign that the test was actually run:

Beginning execution of Run No Evil framework.
Building project for 'vivoactive_hr'... SUCCESS.
Running tests as 'vivoactive_hr'.
Executing tests for entire project.
C:\Garmin\connectiq-sdk-win-2.4.5\bin\monkeydo.bat "....prg" vivoactive_hr /t
Watch was unexpected at this time.

What does "Watch was unexpected at this time" mean?

Thanks
  • I think I've found the cause of the "[token] was unexpected at this time" error. I'm unsure only because it seems to have affected so few of us. I'm using version 3.0.7 of the SDK, and generally the latest everything (plug-in, Eclipse, JRE, etc.).

    A set of IF statements at the beginning of monkeydo.bat reference the command line arguments within quotation marks.

    IF "%1"=="/?" GOTO usage
    IF "%2"=="" GOTO usage


    The (expected) first argument is the path and filename of the Connect IQ executable, which, if containing a space (or perhaps other delimiter), will be passed quoted. So, the extra set of quotation marks breaks the statement. In the OP's case, either his path or filename contained the word "Watch" with a space on either side, e.g., "C:\workspaces\My Watch Face\bin\My Watch Face.prg". The LHS of the equality comparison then resolves to ""C:\workspaces\My, followed by Watch as an "unexpected" token.

    A number of solutions exist. You can avoid spaces in paths and filenames, but these have been supported by Windows for well over 20 years now. You can edit the batch file to insert a tilde between the percent sign and argument number, which removes any quotes surrounding the string. Or you can remove the first IF statement entirely, since it's unnecessary. If the user calls "monkeydo.bat /?", the lack of a second argument will achieve the same result of spitting out the usage notes.

    IF "%~1"=="/?" GOTO usage
    IF "%2"=="" GOTO usage


    (I think the original code had the arguments as %1%, %2%, etc. The second percent sign is unnecessary when the variable ends in a number, but doesn't hurt.)
  • Good catch. We should really be using %~1 and %~2 here. It is just the right thing to do.

    Travis
  • You can avoid spaces in paths and filenames


    Early on I also used spaces in project names etc, but avoiding spaces is what I started doing as a year or so ago there were quite a few places that broke when using spaces.... most of it might be fixed in the mean time, but I stuck to the habit of avoiding spaces.
  • I made a ticket to look into how spaces in project names are effecting Run No Evil.