2008/8/6 Reini Urban <[EMAIL PROTECTED]>:
> 2008/8/6 Reini Urban <[EMAIL PROTECTED]>:
>> 2008/8/6 Reini Urban <[EMAIL PROTECTED]>:
>>> 2008/8/3 Reini Urban via RT <[EMAIL PROTECTED]>:
>>>> First patch was wrong, this is ok. (conf arg was missing)
>>>
>>> And this patch actually implements this feature for 90%. (and or not 
>>> mult.keys)
>>> Just the parenthesis grouping is missing. (and key (not key))
>>>
>>> I'll commit more useful examples later, where I actually need them.
>>> For now just the root Makefile is changed.
>>
>> Adding testcases actually helps.
>> This patch adds tests, and fixes a nasty recursion bug.
>
> And this tests the key=value feature also.
> Now my laptop battery is over soon...

A little bit of power is still left. This patch is against the current
svn of Compiler.pm actually. Sorry.

-- 
Reini Urban
http://phpwiki.org/ http://murbreak.at/
Index: parrot-svn/lib/Parrot/Configure/Compiler.pm
===================================================================
--- parrot-svn.orig/lib/Parrot/Configure/Compiler.pm
+++ parrot-svn/lib/Parrot/Configure/Compiler.pm
@@ -181,17 +181,41 @@ to '#', C<replace_slashes> to enabled, a
 If the name of the file being generated ends in C<Makefile>, this option
 defaults to true.
 
-=item conditioned_lines
+=item conditioned_lines and #+(): #-():
 
-If C<conditioned_lines> is true, then lines in the file that begin with:
-C<#CONDITIONED_LINE(var):> are skipped if the C<var> condition is false. Lines
-that begin with C<#INVERSE_CONDITIONED_LINE(var):> are skipped if
-the C<var> condition is true.  For instance:
+If conditioned_lines is true, then lines in the file that begin with
+C<#+(expr):> are skipped if the expr condition is false.
+Lines that begin with C<#-(var):> are skipped if the expr condition is true.
+For legacy the old syntax #CONDITIONED_LINE(var): and
+#INVERSE_CONDITIONED_LINE(var): is also supported.
+
+A condition expr may be a single keyword, which is true if a config key is true
+or equal to the platform name,
+or a logical combination or (and expr1 expr2...) or (or expr1 expr2...) or
+(not expr) as in the common lisp reader, 'OR' being the default for multiple keys.
+Multiple keys are space seperated.
+
+TODO: Keys may also consist of key=value pairs, where the key is checked for
+equalness to the value. Note that values may contain no spaces here.
+TODO: support quotes in values
 
-  #CONDITIONED_LINE(win32): $(SRC_DIR)/atomic/gcc_x86$(O)
+  #+(var1 var2...) defaults to #+(or var1 var2...)
+  #-(var1 var2...) defaults to #-(or var1 var2...)
+
+For instance:
+
+  #+(win32): $(SRC_DIR)/atomic/gcc_x86$(O)
 
 will be processed if the platform is win32.
 
+  #-(win32 cygwin): $(SRC_DIR)/atomic/gcc_x86$(O)
+
+will be skipped if the platform is win32 or cygwin.
+
+  #+(and win32 glut (not cygwin)):
+
+will be used on win32 and if glut is defined, but not on cygwin.
+
 =item comment_type
 
 This option takes has two possible values, C<#> or C</*>. If present and
@@ -321,12 +345,20 @@ sub genfile {
             last;
         }
         if ( $options{conditioned_lines} ) {
-            if ( $line =~ m/^#CONDITIONED_LINE\(([^)]+)\):(.*)/s ) {
-                next unless $conf->data->get($1);
+	    # allow multiple keys and nested parens here
+            if ( $line =~ m/^#([-+])\((.+)\):(.*)/s ) {
+		my $truth = cond_eval($conf, $2);
+		next if ($1 eq '-') and $truth;
+		next if ($1 eq '+') and not $truth;
+                $line = $3;
+	    }
+	    # but here not (legacy)
+	    elsif ( $line =~ m/^#CONDITIONED_LINE\(([^)]+)\):(.*)/s ) {
+                next unless cond_eval($conf, $1);
                 $line = $2;
             }
             elsif ( $line =~ m/^#INVERSE_CONDITIONED_LINE\(([^)]+)\):(.*)/s ) {
-                next if $conf->data->get($1);
+                next if cond_eval($conf, $1);
                 $line = $2;
             }
         }
@@ -426,6 +458,41 @@ sub genfile {
     move_if_diff( "$target.tmp", $target, $options{ignore_pattern} );
 }
 
+# Just checks the logical truth of the hash value (exists and not empty).
+# Also check the platform name if the hash key does not exist.
+# Recursive, evaluate AND, OR, NOT with multiple keys.
+# Check for key=value, like #+(ld=gcc)
+sub cond_eval {
+    my $conf = shift;
+    my $expr = shift;
+    # TODO: parse parenthesis groups, "(and (not win32) has_glut)"
+    $expr =~ s/[\(\)]/ /g; # currently ignored
+    my @keys = split /\s+/, $expr;
+    if (@keys > 1) { # multiple keys: recurse into
+	my ($truth, $key);
+	my $op = $key = shift @keys;
+	if ($op =~ /^(or|and|not)$/i) {
+	    $op = lc($op);
+	    $key = shift @keys;
+	}
+	while (!$truth and $key) {
+	    $truth = cond_eval($conf, $key);
+	    if ($op eq 'not') { $truth = $truth ? 0 : 1; }
+	    elsif ($op eq 'and') { $truth = (@keys<1) if $truth; }
+	    $key = shift @keys;
+	}
+	return $truth;
+    }
+    if ($expr =~ /^(\w+)=(.+)$/) {
+      return $conf->data->get($1) eq $2;
+    } else {
+      #FIXME: return $conf->data()->exists($key)
+      return exists($conf->data->{c}->{$expr})
+        ? $conf->data()->get($expr)
+	: $expr eq $^O;
+  }
+}
+
 sub append_configure_log {
     my $conf = shift;
     my $target = shift;
@@ -453,6 +520,6 @@ sub append_configure_log {
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
-#   fill-column: 100
+#   fill-column: 80
 # End:
 # vim: expandtab shiftwidth=4:
Index: parrot-svn/lib/Parrot/Configure/Data.pm
===================================================================
--- parrot-svn.orig/lib/Parrot/Configure/Data.pm
+++ parrot-svn/lib/Parrot/Configure/Data.pm
@@ -236,6 +236,32 @@ sub keys {
     return keys %{ $self->{c} };
 }
 
+=item * C<exists()>
+
+=over 4
+
+=item * Purpose
+
+Check if a Parrot::Configure::Data key exists.
+
+=item * Arguments
+
+Name of the key.
+
+=item * Return Value
+
+Defined or undef.
+
+=back
+
+=cut
+
+sub exists {
+    my $self = shift;
+
+    return exists($self->{c}->{shift});
+}
+
 =item * C<slurp()>
 
 =over 4
Index: parrot-svn/config/gen/makefiles/root.in
===================================================================
--- parrot-svn.orig/config/gen/makefiles/root.in
+++ parrot-svn/config/gen/makefiles/root.in
@@ -1,5 +1,5 @@
 # Copyright (C) 2001-2008, The Perl Foundation.
-# $Id: root.in 29767 2008-07-26 18:13:25Z chromatic $
+# $Id: root.in 30049 2008-08-06 04:00:15Z chromatic $
 
 ###############################################################################
 #
@@ -102,10 +102,10 @@ LINK             = @link@
 LINKFLAGS        = @linkflags@ @link_debug@ @ld_debug@
 LD               = @ld@
 LDFLAGS          = @ldflags@ @ld_debug@
-RECONFIGURE      = $(PERL) tools/dev/reconfigure.pl
+RECONFIGURE      = $(PERL) -Ilib tools/dev/reconfigure.pl
 INNO_SETUP       = iscc
 JIT_BUILD_TOOL   = $(BUILD_TOOLS_DIR)/jit2c.pl
-#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
+#+(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
 
 ###############################################################################
 #
@@ -138,7 +138,7 @@ NONGEN_HEADERS   = @TEMP_nongen_headers@
 
 GEN_MAKEFILES = \
     Makefile \
-#CONDITIONED_LINE(has_perldoc):    docs/Makefile \
+#+(has_perldoc):    docs/Makefile \
     compilers/nqp/Makefile \
     compilers/pct/Makefile \
     compilers/pge/Makefile \
@@ -163,9 +163,9 @@ GEN_CONFIGS = \
     lib/Parrot/PMC.pm \
     runtime/parrot/include/config.fpmc \
     $(SRC_DIR)/platform.c \
-#CONDITIONED_LINE(platform_asm):    $(SRC_DIR)/platform_asm.s \
-#CONDITIONED_LINE(has_opengl):    config/gen/call_list/opengl.in \
-#CONDITIONED_LINE(has_glut):    $(SRC_DIR)/glut_callbacks.c \
+#+(platform_asm):    $(SRC_DIR)/platform_asm.s \
+#+(has_opengl):    config/gen/call_list/opengl.in \
+#+(has_glut):    $(SRC_DIR)/glut_callbacks.c \
     $(SRC_DIR)/core_pmcs.c \
     CFLAGS \
     $(IMCC_DIR)/CFLAGS \
@@ -176,14 +176,14 @@ GEN_CONFIGS = \
     $(IMCC_DIR)/imcc.y.flag \
     $(OPS_DIR)/core_ops.c \
     $(OPS_DIR)/core_ops_switch.c \
-    parrot_config parrot_config.c parrot_config.o parrot_config.pbc
+    parrot_config$(EXE) parrot_config.c parrot_config.o parrot_config.pbc
 
 # most of these are generated by config/gen/parrot_include.pm
 
 GEN_PASM_INCLUDES = \
     runtime/parrot/include/signal.pasm \
-#CONDITIONED_LINE(has_opengl):    runtime/parrot/include/opengl_defines.pasm \
-#CONDITIONED_LINE(has_opengl):    runtime/parrot/library/OpenGL_funcs.pir \
+#+(has_opengl):    runtime/parrot/include/opengl_defines.pasm \
+#+(has_opengl):    runtime/parrot/library/OpenGL_funcs.pir \
     @TEMP_gen_pasm_includes@
 
 CONFIGURE_GENERATED_FILES = \
@@ -251,7 +251,7 @@ GEN_LIBRARY = \
     $(LIBRARY_DIR)/MIME/Base64.pbc \
     $(LIBRARY_DIR)/NCI/call_toolkit_init.pbc \
     $(LIBRARY_DIR)/ncurses.pbc \
-#CONDITIONED_LINE(has_opengl):    $(LIBRARY_DIR)/OpenGL.pbc \
+#+(has_opengl):    $(LIBRARY_DIR)/OpenGL.pbc \
     $(LIBRARY_DIR)/P6object.pbc \
     $(LIBRARY_DIR)/parrotlib.pbc \
     $(LIBRARY_DIR)/pcre.pbc \
@@ -369,7 +369,7 @@ INTERP_O_FILES = \
     $(OPS_DIR)/core_ops$(O) \
     $(OPS_DIR)/core_ops_switch$(O) \
     \
-#CONDITIONED_LINE(i386_has_gcc_cmpxchg):    $(SRC_DIR)/atomic/gcc_x86$(O) \
+#+(i386_has_gcc_cmpxchg):    $(SRC_DIR)/atomic/gcc_x86$(O) \
     $(SRC_DIR)/builtin$(O) \
     $(SRC_DIR)/byteorder$(O) \
     $(SRC_DIR)/charset$(O) \
@@ -442,7 +442,7 @@ INTERP_O_FILES = \
     @TEMP_atomic_o@ \
     @TEMP_jit_o@ \
     @TEMP_gc_o@ \
-#CONDITIONED_LINE(platform_asm):    $(SRC_DIR)/platform_asm$(O) \
+#+(platform_asm):    $(SRC_DIR)/platform_asm$(O) \
 
 O_FILES = \
     $(INTERP_O_FILES) \
@@ -484,14 +484,14 @@ INSTALLABLEPDB      = $(CUR_DIR)/install
 
 # Libraries
 LIBPARROT_STATIC    = @blib_dir@/@libparrot_static@
-#CONDITIONED_LINE(darwin):export DYLD_LIBRARY_PATH := @blib_dir@:$(DYLD_LIBRARY_PATH)
-#CONDITIONED_LINE(win32):LIBPARROT_SHARED  = @libparrot_shared@
-#INVERSE_CONDITIONED_LINE(win32):LIBPARROT_SHARED  = @blib_dir@/@libparrot_shared@
+#+(darwin):export DYLD_LIBRARY_PATH := @blib_dir@:$(DYLD_LIBRARY_PATH)
+#+(win32):LIBPARROT_SHARED  = @libparrot_shared@
+#-(win32):LIBPARROT_SHARED  = @blib_dir@/@libparrot_shared@
 
 # This line controls whether a static or shared library is built
 LIBPARROT           = @libparrot@
 
-#CONDITIONED_LINE(has_icu):ICU_SHARED  = @icu_shared@
+#+(has_icu):ICU_SHARED  = @icu_shared@
 ALL_PARROT_LIBS     = @libparrot_ldflags@ $(ICU_SHARED) $(C_LIBS)
 
 # dynamic extensions
@@ -548,13 +548,14 @@ MAKE = @make_c@
 
 all : \
     flags_dummy \
+    Makefile \
     PARROT_LIBS \
     $(PARROT) \
     runtime/parrot/include/parrotlib.pbc \
     runtime/parrot/include/config.fpmc \
     docs \
     $(LIBNCI_TEST_SO) \
-#CONDITIONED_LINE(has_glut):    $(LIBGLUTCB_SO) \
+#+(has_glut):    $(LIBGLUTCB_SO) \
     $(GEN_LIBRARY) \
     dynpmc \
     dynoplibs \
@@ -574,6 +575,7 @@ STR_FILES = \
     $(SRC_DIR)/builtin.str \
     $(SRC_DIR)/debug.str \
     $(SRC_DIR)/dynext.str \
+    $(SRC_DIR)/events.str \
     $(SRC_DIR)/exceptions.str \
     $(SRC_DIR)/global.str \
     $(SRC_DIR)/global_setup.str \
@@ -586,13 +588,16 @@ STR_FILES = \
     $(SRC_DIR)/key.str \
     $(SRC_DIR)/library.str \
     $(SRC_DIR)/mmd.str \
+    $(SRC_DIR)/nci.str \
     $(SRC_DIR)/packfile.str \
     $(SRC_DIR)/pmc.str \
+    $(SRC_DIR)/pmc_freeze.str \
     $(SRC_DIR)/oo.str \
     $(SRC_DIR)/scheduler.str \
     $(SRC_DIR)/spf_render.str \
     $(SRC_DIR)/spf_vtable.str \
     $(SRC_DIR)/sub.str \
+    $(SRC_DIR)/stacks.str \
     \
     $(CLASS_STR_FILES)
 
@@ -617,6 +622,10 @@ PMC2CV = $(PERL) $(BUILD_TOOLS_DIR)/pmc2
 vtable.dump : src/vtable.tbl
 	$(PMC2CV)
 
+# regenerate the Makefile
+Makefile: config/gen/makefiles/root.in
+	$(RECONFIGURE) --step=gen::makefiles --target=Makefile
+
 # This is a listing of all targets meant to be called by users
 help :
 	@echo ""
@@ -774,8 +783,8 @@ $(PARROT) : $(SRC_DIR)/main$(O) $(GEN_HE
     lib/Parrot/OpLib/core.pm $(SRC_DIR)/parrot_config$(O) \
     $(MINIPARROT)
 	$(LINK) @[EMAIL PROTECTED]@ \
-    $(SRC_DIR)/main$(O) @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(LINK_DYNAMIC) \
-    $(SRC_DIR)/parrot_config$(O)
+	$(SRC_DIR)/main$(O) $(SRC_DIR)/parrot_config$(O) \
+	@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(LINK_DYNAMIC) \
 
 pbc_to_exe.pir : $(PARROT) tools/dev/pbc_to_exe_gen.pl
 	$(PERL) tools/dev/pbc_to_exe_gen.pl \
@@ -790,7 +799,7 @@ $(PARROT_CONFIG) : tools/util/parrot-con
 	$(PARROT) pbc_to_exe.pir parrot_config.pbc
 
 # HLL Executable targets
-#CONDITIONED_LINE(win32):perl6 : $(PERL6)
+#+(win32):perl6 : $(PERL6)
 
 $(PERL6) : compilers $(PBC_TO_EXE)
 	$(MAKE) languages/perl6 perl6$(EXE)
@@ -802,8 +811,8 @@ $(PERL6) : compilers $(PBC_TO_EXE)
 # TODO build the real miniparrot
 $(MINIPARROT) : $(SRC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
     lib/Parrot/OpLib/core.pm $(SRC_DIR)/null_config$(O)
-	$(LINK) @[EMAIL PROTECTED]@ $(SRC_DIR)/main$(O) \
-    @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(SRC_DIR)/null_config$(O)
+	$(LINK) @[EMAIL PROTECTED]@ $(SRC_DIR)/main$(O) $(SRC_DIR)/null_config$(O) \
+	@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 
 $(INSTALLABLEPARROT) : $(SRC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
     lib/Parrot/OpLib/core.pm $(SRC_DIR)/install_config$(O) \
@@ -868,8 +877,8 @@ check_source : $(GENERAL_H_FILES)
 # so always delete the lib -leo
 
 PARROT_LIBS: \
-#CONDITIONED_LINE(has_static_linking):  $(LIBPARROT_STATIC) \
-#CONDITIONED_LINE(has_dynamic_linking): $(LIBPARROT_SHARED)
+#+(has_static_linking):  $(LIBPARROT_STATIC) \
+#+(has_dynamic_linking): $(LIBPARROT_SHARED)
 
 $(LIBPARROT_STATIC) : $(O_FILES)
 	$(MKPATH) @blib_dir@
@@ -881,7 +890,7 @@ $(LIBPARROT_SHARED) : $(O_FILES)
 	$(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) @[EMAIL PROTECTED]@ @libparrot_soname@ \
 #+(cygchkdll):		-Wl,--out-implib=blib/lib/libparrot.dll.a \
 		$(O_FILES) $(C_LIBS) $(ICU_SHARED)
-#CONDITIONED_LINE(libparrot_shared_alias):	( cd @blib_dir@ ; ln -sf @libparrot_shared@ @libparrot_shared_alias@ )
+#+(libparrot_shared_alias):	( cd @blib_dir@ ; ln -sf @libparrot_shared@ @libparrot_shared_alias@ )
 
 
 #
@@ -1017,7 +1026,7 @@ $(SRC_DIR)/global$(O) : $(GENERAL_H_FILE
 
 $(SRC_DIR)/pmc$(O) : $(GENERAL_H_FILES)
 
-$(SRC_DIR)/pmc_freeze$(O) : $(GENERAL_H_FILES)
+$(SRC_DIR)/pmc_freeze$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/pmc_freeze.str
 
 $(SRC_DIR)/hash$(O) : $(GENERAL_H_FILES)
 
@@ -1048,7 +1057,7 @@ $(SRC_DIR)/exec_start$(O) : $(GENERAL_H_
 
 $(SRC_DIR)/exec_save$(O) : $(GENERAL_H_FILES) @TEMP_exec_h@
 
-$(SRC_DIR)/key$(O) : $(GENERAL_H_FILES)
+$(SRC_DIR)/key$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/key.str
 
 $(SRC_DIR)/gc/smallobject$(O) : $(GENERAL_H_FILES)
 
@@ -1068,8 +1077,8 @@ $(SRC_DIR)/hll$(O) : $(GENERAL_H_FILES) 
 
 $(SRC_DIR)/platform$(O) : $(GENERAL_H_FILES)
 
-#CONDITIONED_LINE(platform_asm):$(SRC_DIR)/platform_asm$(O) : $(GENERAL_H_FILES)
-#CONDITIONED_LINE(platform_asm):
+#+(platform_asm):$(SRC_DIR)/platform_asm$(O) : $(GENERAL_H_FILES)
+#+(platform_asm):
 $(SRC_DIR)/core_pmcs$(O) : $(GENERAL_H_FILES)
 
 $(SRC_DIR)/trace$(O) : $(GENERAL_H_FILES)
@@ -1164,7 +1173,7 @@ $(SRC_DIR)/dataypes$(O) : $(GENERAL_H_FI
 
 $(SRC_DIR)/exit$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exit.c
 
-$(SRC_DIR)/nci$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci.c
+$(SRC_DIR)/nci$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci.c $(SRC_DIR)/nci.str
 
 $(SRC_DIR)/vtables$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/vtables.c
 
@@ -1260,11 +1269,11 @@ $(IMCC_O_FILES) : $(IMCC_H_FILES) $(ALL_
 #
 ###############################################################################
 
-#CONDITIONED_LINE(has_perldoc):docs : docs.dummy
-#INVERSE_CONDITIONED_LINE(has_perldoc):docs : docs.stub
+#+(has_perldoc):docs : docs.dummy
+#-(has_perldoc):docs : docs.stub
 
-#CONDITIONED_LINE(has_perldoc):html : html.dummy
-#INVERSE_CONDITIONED_LINE(has_perldoc):html : html.stub
+#+(has_perldoc):html : html.dummy
+#-(has_perldoc):html : html.stub
 
 html.stub:
 	@echo "Perldoc is required, but not detected."
@@ -1460,10 +1469,10 @@ check : test
 # when the needed runcores are available
 fulltest :
 	[EMAIL PROTECTED]@ testb
-#CONDITIONED_LINE(cg_flag):	[EMAIL PROTECTED]@ testC
+#+(cg_flag):	[EMAIL PROTECTED]@ testC
 	[EMAIL PROTECTED]@ testf
-#CONDITIONED_LINE(cg_flag):	[EMAIL PROTECTED]@ testg
-#CONDITIONED_LINE(cg_flag):	[EMAIL PROTECTED]@ testj
+#+(cg_flag):	[EMAIL PROTECTED]@ testg
+#+(cg_flag):	[EMAIL PROTECTED]@ testj
 	[EMAIL PROTECTED]@ testr
 	[EMAIL PROTECTED]@ testS
 	[EMAIL PROTECTED]@ src_tests
@@ -1575,15 +1584,15 @@ clean : \
     prog-clean \
     dynext-clean \
     languages-clean \
-#CONDITIONED_LINE(has_perldoc):    docs-clean \
-#CONDITIONED_LINE(has_perldoc):    html-clean \
+#+(has_perldoc):    docs-clean \
+#+(has_perldoc):    html-clean \
     dynpmc-clean \
     dynoplibs-clean \
     examples-clean \
     imcc-clean \
     compilers-clean \
     smoke-clean \
-#INVERSE_CONDITIONED_LINE(win32):    cover-clean \
+#-(win32):    cover-clean \
     editor-clean
 	@TEMP_cg_r@
 	$(RM_F) chartypes "*.s" "*~"
@@ -2040,10 +2049,10 @@ COVER_DIRS = \
 cover: \
     cover.dummy \
     cover-testb \
-#CONDITIONED_LINE(cg_flag):    cover-testC \
+#+(cg_flag):    cover-testC \
     cover-testf \
-#CONDITIONED_LINE(cg_flag):    cover-testg \
-#CONDITIONED_LINE(jitcapable):    cover-testj \
+#+(cg_flag):    cover-testg \
+#+(jitcapable):    cover-testj \
     cover-testr \
     cover-testS \
     cover-src \
Index: parrot-svn/lib/Parrot/Configure/Test.pm
===================================================================
--- parrot-svn.orig/lib/Parrot/Configure/Test.pm
+++ parrot-svn/lib/Parrot/Configure/Test.pm
@@ -77,7 +77,7 @@ sub test_step_constructor_and_descriptio
 
 =head1 NAME
 
-Parrot::Configure::Test - subroutines used in F<t/configure/*> tests
+Parrot::Configure::Test - subroutines used in F<t/configure/*> and F<t/steps/*> tests
 
 =head1 SYNOPSIS
 
Index: parrot-svn/t/steps/gen_makefiles-01.t
===================================================================
--- parrot-svn.orig/t/steps/gen_makefiles-01.t
+++ parrot-svn/t/steps/gen_makefiles-01.t
@@ -5,9 +5,9 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  7;
+use Test::More tests =>  19;
 use Carp;
-use lib qw( lib );
+use lib qw( . lib );
 use_ok('config::gen::makefiles');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
@@ -38,6 +38,43 @@ foreach my $k ( keys %makefiles ) {
 is($missing_SOURCE, 0, "No Makefile source file missing");
 ok(-f $step->{CFLAGS_source}, "CFLAGS source file located");
 
+# test #+(keys):line
+$conf->data->set( dummy1 => 1, dummy2 => 0, dummy3 => 'xx' );
+open IN, ">Makefile.in";
+print IN "#+(dummy1):+dummy1\n";
+print IN "#+(dummy2):+dummy2\n";
+print IN "#+(dummy3=xx):+dummy3=xx\n";
+print IN "#+(dummy3=xxx):+dummy3=xxx\n";
+print IN "#+(dummy1 dummy2):+dummy1_or_2\n";
+print IN "#+(and dummy1 dummy2):+dummy1_and_2\n";
+print IN "#-(dummy1):-dummy1\n";
+print IN "#-(dummy2):-dummy2\n";
+print IN "#-(dummy3=xx):-dummy3=xx\n";
+print IN "#-(dummy3=xxx):-dummy3=xxx\n";
+print IN "#-(dummy1 dummy2):-dummy1_or_2\n";
+print IN "#-(and dummy1 dummy2):-dummy1_and_2\n";
+close IN;
+$conf->genfile('Makefile.in','Makefile.out',(makefile => 1));
+open OUT, "<Makefile.out";
+my $f;
+{
+    local $/;
+    $f = <OUT>;
+}
+unlink "Makefile.in", "Makefile.out";
+ok($f =~ /^\+dummy1$/m, "+dummy1");
+ok($f !~ /^\+dummy2$/m, "+dummy2");
+ok($f =~ /^\+dummy3=xx$/m, "+dummy3=xx");
+ok($f !~ /^\+dummy3=xxx$/m, "+dummy3=xxx");
+ok($f =~ /^\+dummy1_or_2$/m, "+dummy1_or_2");
+ok($f !~ /^\+dummy1_and_2$/m, "+dummy1_and_2");
+ok($f !~ /^\-dummy1$/m, "-dummy1");
+ok($f =~ /^\-dummy2$/m, "-dummy2");
+ok($f !~ /^\-dummy3=xx$/m, "-dummy3=xx");
+ok($f =~ /^\-dummy3=xxx$/m, "-dummy3=xxx");
+ok($f !~ /^\-dummy1_or_2$/m, "-dummy1_or_2");
+ok($f =~ /^\-dummy1_and_2$/m, "-dummy1_and_2");
+
 pass("Completed all tests in $0");
 
 ################### DOCUMENTATION ###################
@@ -59,6 +96,7 @@ The tests in this file test gen::makefil
 =head1 AUTHOR
 
 James E Keenan
+Reini Urban (conditioned_lines)
 
 =head1 SEE ALSO
 

Reply via email to