[augeas-devel] [PATCH] Rewrite test_inifile.aug with new functions

Raphael Pinson raphink at gmail.com
Tue Aug 19 08:55:55 UTC 2008


# HG changeset patch
# User Raphael Pinson <raphink at gmail.com>
# Date 1219136139 -7200
# Node ID f58164c15e84bb9ec1e6b7b4132be6e56c8cd001
# Parent  dc2a732107015d16a90715c20e426ca116a51a4f
Rewrite test_inifile.aug with new functions

diff -r dc2a73210701 -r f58164c15e84 lenses/tests/test_inifile.aug
--- a/lenses/tests/test_inifile.aug	Thu Aug 14 17:50:22 2008 +0200
+++ b/lenses/tests/test_inifile.aug	Tue Aug 19 10:55:39 2008 +0200
@@ -2,16 +2,19 @@ module Test_IniFile =
 
   (* ALL TESTS TO RUN *)
 
-  (* entry   :  (a) entry;   (b) entry_nocolon       *)
-  (* comment :  (c) comment; (d) comment_nosharp     *)
-  (* lns     :  (e) lns;     (f) lns_noempty         *)
+  (* separator   :  (a) default (/[:=]/ "=") ;   (b) "=" "="     *)
+  (* comment     :  (c) default (/[;#]/ ";") ;   (d) ";" ";"     *)
+  (* empty lines :  (e) default              ;   (f) noempty     *)
 
 
   (* TEST a/c/e *)
-  let entry_ace  = IniFile.entry "test_ace"
-  let record_ace = IniFile.record "record_ace" entry_ace
-  let lns_ace    = IniFile.lns record_ace
-  let conf_ace   = "# comment with sharp
+  let comment_ace = IniFile.comment IniFile.comment_re IniFile.comment_default
+  let sep_ace     = IniFile.sep IniFile.sep_re IniFile.sep_default
+  let entry_ace   = IniFile.entry IniFile.entry_re sep_ace comment_ace
+  let title_ace   = IniFile.title IniFile.record_re
+  let record_ace  = IniFile.record title_ace entry_ace
+  let lns_ace     = IniFile.lns record_ace comment_ace
+  let conf_ace    = "# comment with sharp
 
 [section1]
 test_ace = value # end of line comment
@@ -22,7 +25,7 @@ test_ace =
   test lns_ace get conf_ace = 
       { "#comment" = "comment with sharp" }
       {}
-      { "record_ace" = "section1"
+      { "section1"
           { "test_ace" = "value"
 	     { "#comment" = "end of line comment" } }
 	  { "test_ace" }
@@ -31,9 +34,12 @@ test_ace =
 
 
   (* TEST a/c/f *)
-  let entry_acf  = IniFile.entry "test_acf"
-  let record_acf = IniFile.record_noempty "record_acf" entry_acf
-  let lns_acf    = IniFile.lns_noempty record_acf
+  let comment_acf = IniFile.comment IniFile.comment_re IniFile.comment_default
+  let sep_acf     = IniFile.sep IniFile.sep_re IniFile.sep_default
+  let entry_acf   = IniFile.entry IniFile.entry_re sep_acf comment_acf
+  let title_acf   = IniFile.title IniFile.record_re
+  let record_acf  = IniFile.record_noempty title_acf entry_acf
+  let lns_acf     = IniFile.lns_noempty record_acf comment_acf
   let conf_acf   = "# comment with sharp
 [section1]
 test_acf = value 
@@ -43,7 +49,7 @@ test_acf : value2 # end of line comment
 "
   test lns_acf get conf_acf = 
       { "#comment" = "comment with sharp" }
-      { "record_acf" = "section1"
+      { "section1"
          { "test_acf" = "value" }
 	 { "test_acf" }
          { "test_acf" = "value2"
@@ -52,10 +58,12 @@ test_acf : value2 # end of line comment
 
 
   (* TEST a/d/e *)
-  let comment_ade = IniFile.comment_nosharp
-  let entry_ade   = IniFile.entry_setcomment "test_ade" comment_ade
-  let record_ade  = IniFile.record_setcomment "record_ade" entry_ade comment_ade
-  let lns_ade     = IniFile.lns_setcomment record_ade comment_ade
+  let comment_ade = IniFile.comment ";" ";"
+  let sep_ade     = IniFile.sep IniFile.sep_re IniFile.sep_default
+  let entry_ade   = IniFile.entry IniFile.entry_re sep_ade comment_ade
+  let title_ade   = IniFile.title IniFile.record_re
+  let record_ade  = IniFile.record title_ade entry_ade
+  let lns_ade     = IniFile.lns record_ade comment_ade
   let conf_ade    = "; a first comment with colon
 [section1]
 test_ade = value
@@ -66,7 +74,7 @@ test_ade =
 "
    test lns_ade get conf_ade =
       { "#comment" = "a first comment with colon" }
-      { "record_ade" = "section1"
+      { "section1"
          { "test_ade" = "value" }
          { "test_ade" = "value2"
 	    { "#comment" = "end of line comment" } }
@@ -76,10 +84,12 @@ test_ade =
 
 
   (* TEST a/d/f *)
-  let comment_adf = IniFile.comment_nosharp
-  let entry_adf   = IniFile.entry_setcomment "test_adf" comment_adf
-  let record_adf  = IniFile.record_noempty_setcomment "record_adf" entry_adf comment_adf
-  let lns_adf     = IniFile.lns_noempty_setcomment record_adf comment_adf
+  let comment_adf = IniFile.comment ";" ";"
+  let sep_adf     = IniFile.sep IniFile.sep_re IniFile.sep_default
+  let entry_adf   = IniFile.entry IniFile.entry_re sep_adf comment_adf
+  let title_adf   = IniFile.title IniFile.record_re
+  let record_adf  = IniFile.record_noempty title_adf entry_adf
+  let lns_adf     = IniFile.lns_noempty record_adf comment_adf
   let conf_adf    = "; a first comment with colon
 [section1]
 test_adf = value
@@ -89,7 +99,7 @@ test_adf =
 "
    test lns_adf get conf_adf =
       { "#comment" = "a first comment with colon" }
-      { "record_adf" = "section1"
+      { "section1"
          { "test_adf" = "value" }
          { "test_adf" = "value2"
 	    { "#comment" = "end of line comment" } }
@@ -98,9 +108,12 @@ test_adf =
 
 
   (* TEST b/c/e *)
-  let entry_bce  = IniFile.entry_nocolon "test_bce"
-  let record_bce = IniFile.record "record_bce" entry_bce
-  let lns_bce    = IniFile.lns record_bce
+  let comment_bce = IniFile.comment IniFile.comment_re IniFile.comment_default
+  let sep_bce     = IniFile.sep "=" "="
+  let entry_bce   = IniFile.entry IniFile.entry_re sep_bce comment_bce
+  let title_bce   = IniFile.title IniFile.record_re
+  let record_bce  = IniFile.record title_bce entry_bce
+  let lns_bce     = IniFile.lns record_bce comment_bce
   let conf_bce   = "# comment with sharp
 
 [section1]
@@ -112,7 +125,7 @@ test_bce =
   test lns_bce get conf_bce = 
       { "#comment" = "comment with sharp" }
       {}
-      { "record_bce" = "section1"
+      { "section1"
           { "test_bce" = "value"
 	     { "#comment" = "end of line comment" } }
 	  { "#comment"  = "comment with colon" }
@@ -121,9 +134,12 @@ test_bce =
 
 
   (* TEST b/c/f *)
-  let entry_bcf  = IniFile.entry_nocolon "test_bcf"
-  let record_bcf = IniFile.record_noempty "record_bcf" entry_bcf
-  let lns_bcf    = IniFile.lns_noempty record_bcf
+  let comment_bcf = IniFile.comment IniFile.comment_re IniFile.comment_default
+  let sep_bcf     = IniFile.sep "=" "="
+  let entry_bcf   = IniFile.entry IniFile.entry_re sep_bcf comment_bcf
+  let title_bcf   = IniFile.title IniFile.record_re
+  let record_bcf  = IniFile.record_noempty title_bce entry_bcf
+  let lns_bcf     = IniFile.lns_noempty record_bce comment_bcf
   let conf_bcf   = "# comment with sharp
 [section1]
 test_bcf = value # end of line comment
@@ -132,7 +148,7 @@ test_bcf =
 "
   test lns_bcf get conf_bcf = 
       { "#comment" = "comment with sharp" }
-      { "record_bcf" = "section1"
+      { "section1"
           { "test_bcf" = "value"
 	     { "#comment" = "end of line comment" } }
 	  { "#comment"  = "comment with colon" }
@@ -140,10 +156,12 @@ test_bcf =
 
 
   (* TEST b/d/e *)
-  let comment_bde = IniFile.comment_nosharp
-  let entry_bde   = IniFile.entry_nocolon_setcomment "test_bde" comment_bde
-  let record_bde  = IniFile.record_setcomment "record_bde" entry_bde comment_bde
-  let lns_bde     = IniFile.lns_setcomment record_bde comment_bde
+  let comment_bde = IniFile.comment ";" ";"
+  let sep_bde     = IniFile.sep "=" "="
+  let entry_bde   = IniFile.entry IniFile.entry_re sep_bde comment_bde
+  let title_bde   = IniFile.title IniFile.record_re
+  let record_bde  = IniFile.record title_bde entry_bde
+  let lns_bde     = IniFile.lns record_bde comment_bde
   let conf_bde    = "; first comment with colon
 
 [section1]
@@ -155,7 +173,7 @@ test_bde =
   test lns_bde get conf_bde = 
       { "#comment" = "first comment with colon" }
       {}
-      { "record_bde" = "section1"
+      { "section1"
           { "test_bde" = "value"
 	     { "#comment" = "end of line comment" } }
 	  { "#comment"  = "comment with colon" }
@@ -164,10 +182,12 @@ test_bde =
 
 
   (* TEST b/d/f *)
-  let comment_bdf = IniFile.comment_nosharp
-  let entry_bdf   = IniFile.entry_nocolon_setcomment "test_bdf" comment_bdf
-  let record_bdf  = IniFile.record_noempty_setcomment "record_bdf" entry_bdf comment_bdf
-  let lns_bdf     = IniFile.lns_noempty_setcomment record_bdf comment_bdf
+  let comment_bdf = IniFile.comment ";" ";"
+  let sep_bdf     = IniFile.sep "=" "="
+  let entry_bdf   = IniFile.entry IniFile.entry_re sep_bdf comment_bdf
+  let title_bdf   = IniFile.title IniFile.record_re
+  let record_bdf  = IniFile.record_noempty title_bdf entry_bdf
+  let lns_bdf     = IniFile.lns_noempty record_bdf comment_bdf
   let conf_bdf    = "; first comment with colon
 [section1]
 test_bdf = value ; end of line comment
@@ -176,7 +196,7 @@ test_bdf =
 "
   test lns_bdf get conf_bdf = 
       { "#comment" = "first comment with colon" }
-      { "record_bdf" = "section1"
+      { "section1"
           { "test_bdf" = "value"
 	     { "#comment" = "end of line comment" } }
 	  { "#comment"  = "comment with colon" }




More information about the augeas-devel mailing list