[Bps-public-commit] Config-GitLike branch, master, updated. aebcc16538e7c736bb6bfb8744b8237983fc884e

spang at bestpractical.com spang at bestpractical.com
Mon Jun 8 12:10:42 EDT 2009


The branch, master has been updated
       via  aebcc16538e7c736bb6bfb8744b8237983fc884e (commit)
      from  fc6eea1332c540ff41074ceba019e572742819a9 (commit)

Summary of changes:
 lib/Config/GitLike.pm |    2 +-
 t/t1300-repo-config.t |   54 +++++++++++++++++++++++-------------------------
 2 files changed, 27 insertions(+), 29 deletions(-)

- Log -----------------------------------------------------------------
commit aebcc16538e7c736bb6bfb8744b8237983fc884e
Author: Christine Spang <spang at mit.edu>
Date:   Mon Jun 8 19:09:21 2009 +0300

    bugfix: compare variable names case-insensitively (and un-TODO the related test)

diff --git a/lib/Config/GitLike.pm b/lib/Config/GitLike.pm
index ac258a5..b0a5129 100644
--- a/lib/Config/GitLike.pm
+++ b/lib/Config/GitLike.pm
@@ -702,7 +702,7 @@ sub set {
             $new = $got{offset} + $got{length};
             return unless defined $got{name};
             push @replace, {offset => $got{offset}, length => $got{length}}
-                if lc $key eq $got{name};
+                if lc $key eq lc $got{name};
         },
         error    => sub {
             die "Error parsing $args{filename}, near:\n at _\n";
diff --git a/t/t1300-repo-config.t b/t/t1300-repo-config.t
index 057df4a..a06c0fd 100644
--- a/t/t1300-repo-config.t
+++ b/t/t1300-repo-config.t
@@ -216,36 +216,24 @@ EOF
 
 is(slurp($config_filename), $expect, 'really mean test');
 
-# note: this is a bug!
-TODO: {
-    local $TODO = "cannot handle replacing value after section w/o newline yet";
-
-    $config->set(key => 'nextsection.nonewline', value => 'wow', filename => $config_filename);
+$config->set(key => 'nextsection.nonewline', value => 'wow', filename =>
+    $config_filename);
 
-    $expect = <<'EOF'
+# NOTE: git moves the definition of the variable without a newline
+# to the next line;
+# let's not do that since we do substring replacement rather than
+# reformatting
+$expect = <<'EOF'
 [beta] ; silly comment # another comment
 noIndent= sillyValue ; 'nother silly comment
 
 		; comment
 	haha = alpha
-[nextSection]
-	nonewline = wow
+[nextSection] nonewline = wow
 EOF
-    ;
-
-    is(slurp($config_filename), $expect, 'really really mean test');
-}
-
-# XXX remove this burp after un-TODOing the above block
-burp($config_filename,
-'[beta] ; silly comment # another comment
-noIndent= sillyValue ; \'nother silly comment
+;
 
-		; comment
-	haha = alpha
-[nextSection]
-	nonewline = wow
-');
+is(slurp($config_filename), $expect, 'really really mean test');
 
 $config->load;
 is($config->get(key => 'beta.haha'), 'alpha', 'get value');
@@ -258,8 +246,7 @@ $expect = <<'EOF'
 noIndent= sillyValue ; 'nother silly comment
 
 		; comment
-[nextSection]
-	nonewline = wow
+[nextSection] nonewline = wow
 EOF
 ;
 
@@ -276,8 +263,7 @@ TODO: {
 noIndent= sillyValue ; 'nother silly comment
 
 		; comment
-[nextSection]
-	nonewline = wow
+[nextSection] nonewline = wow
 	NoNewLine = wow2 for me
 EOF
     ;
@@ -302,11 +288,11 @@ EOF
         filename => $config_filename);
 
     $expect = <<'EOF'
+[beta] ; silly comment # another comment
 noIndent= sillyValue ; 'nother silly comment
 
         ; comment
-[nextSection]
-    nonewline = wow3
+[nextSection] nonewline = wow3
     NoNewLine = wow2 for me
 EOF
     ;
@@ -328,6 +314,7 @@ EOF
         "multivar unset doesn't crash";
 
     $expect = <<'EOF'
+[beta] ; silly comment # another comment
 noIndent= sillyValue ; 'nother silly comment
 
 		; comment
@@ -339,6 +326,17 @@ EOF
     is(slurp($config_filename), $expect, 'multivar unset');
 }
 
+# XXX remove this burp after fixing the replace/unset all stuff above (just
+# using it to bootstrap the rest of the tests)
+burp($config_filename,
+'[beta] ; silly comment # another comment
+noIndent= sillyValue ; \'nother silly comment
+
+		; comment
+[nextSection]
+	NoNewLine = wow2 for me
+');
+
 throws_ok { $config->set(key => 'inval.2key', value => 'blabla', filename =>
         $config_filename) } qr/invalid key/i, 'invalid key';
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list