SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Mar 2001
    Posts
    161
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need to feed args to main()

    User Yoo, John (John.Yoo@GrassValleyGroup.com.nospam) posted:

    Hello,

    I wonder there is a way to feed args in main().
    My sample test code is,

    In the Test-Arg.t script, I created as follow.

    main (STRING sNumber)
    {
    print (sNumber);
    }

    I want to run this main () from in my test suite, i.e., Test-Arg.s;

    Run Test-Arg.s in the following line;
    Test-Arg.t Bob

    I expected the print statement will produce Bob in the monitor.
    Instead, Error shows up when I run Test-Arg.s
    (No complie error in either _.t and _.s files.

    ---
    Script test-ms.t (Bob) - 1 error
    Machine: (local)
    Started: 11:11:55AM on 15-Oct-2001
    Elapsed: 0:00:00
    Totals: 1 error, 0 warnings
    *** Error: Incorrect number of arguments to function main
    ---

    I wonder why it give me error "*** Error: Incorrect number of arguments to
    function main"

    Appreciate your help!

    /John Yoo


  2. #2
    Junior Member
    Join Date
    Jul 2001
    Location
    Beaverton, Oregon, USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Need to feed args to main()

    User Sean McCabe (seanm@segue.com.nospam) posted:

    John,

    You don't need to put arguments into the main() function as the arguments are not processed that way. What
    you want to do is put a GetArgs() function inside the main:
    MyScript.t
    main()
    LIST OF STRING lsArgs = GetArgs()
    STRING sArg
    for each sArg in lsArgs
    print (sArg)

    MySuite.s
    myscript.t "Sean" "Another Arg" arg_without_quotes "final Arg"

    Yes, further proof that if a testing tool could walk on water, it would be wearing a red hat.
    "Yoo, John" wrote:
    [Non-text portions of this message have been removed]



  3. #3
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Need to feed args to main()

    John,

    You can't pass arguments directly, but you can pass them indirectly.

    Simply do the following:
    -David Genrich


    ------------------
    David Genrich
    david@e2Open.com
    david_kim@usa.net

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:38 PM.

Copyright BetaSoft Inc.