# (C) Copyright David Abrahams 2001. Permission to copy, use,
# modify, sell and distribute this software is granted provided this
# copyright notice appears in all copies. This software is provided
# "as is" without express or implied warranty, and with no claim as
# to its suitability for any purpose.

#
# Jam code for testing the named-argument patch.
#

include recursive.jam ;

# Prefixes for all of the jam code we're going to test
local ECHO_ARGS = "include echo_args.jam ; echo_args "
   ;

local ECHO_VARARGS = "include echo_args.jam ; echo_varargs "
   ;

# Check that it will find missing arguments
Jam-fail $(ECHO_ARGS)";"
    : "missing argument a"
    ;

# Check that it will find if too many arguments are passed
Jam-fail $(ECHO_ARGS)"1 2 : 3 : 4 : 5 ;"
    : "extra argument 5"
    ;

# Check that it will find when an argument has too many elements
Jam-fail $(ECHO_ARGS)"a b c1 c2 : d ;"
    : "extra argument c2"
    ;

# Check modifier '?'
Jam $(ECHO_ARGS)"1 2 3 : 4 ;"
    : "a= 1 b= 2 c= 3 : d= 4 : e=" ;
Jam $(ECHO_ARGS)"1 2 : 3 ;"
    : "a= 1 b= 2 c= : d= 3 : e=" ;
Jam $(ECHO_ARGS)"1 : 2 ;"
    : "a= 1 b= c= : d= 2 : e=" ;

# Check modifier '+'
Jam-fail $(ECHO_ARGS)"1 ;"
    : "missing argument d" ;
Jam $(ECHO_ARGS)"1 : 2 3 ;"
    : "a= 1 b= c= : d= 2 3 : e=" ;
Jam $(ECHO_ARGS)"1 : 2 3 4 ;"
    : "a= 1 b= c= : d= 2 3 4 : e=" ;

# Check modifier '*'
Jam $(ECHO_ARGS)"1 : 2 : 3 ;"
    : "a= 1 b= c= : d= 2 : e= 3" ;
Jam $(ECHO_ARGS)"1 : 2 : 3 4 ;"
    : "a= 1 b= c= : d= 2 : e= 3 4" ;
Jam $(ECHO_ARGS)"1 : 2 : 3 4 5 ;"
    : "a= 1 b= c= : d= 2 : e= 3 4 5" ;

#
# Check varargs
#
Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 ;"
    : "a= 1 b= c= : d= 2 : e= 3 4 5" ;
Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 ;"
    : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6" ;
Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 7 ;"
    : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7" ;
Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 7 : 8 ;"
    : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8" ;
Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 7 : 8 : 9 ;"
    : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8 : 9" ;


