Now that I have my get tests working like [I think] they should I've moved on
to the put tests and am having the following error when I try to delete a
sub-tree:

modulesautoload.aug:123.2-125.5:exception thrown in test
modulesautoload.aug:123.7-124.18:exception: Failed to match
    { /[0123456789]+/ = /([0-9A-Z_a-z-]+)/ }*
  with tree
    { "2" = "option2" } { "3" }
    Lens: modulesautoload.aug:21.17-23.20:
    Error encountered at path /ip_gre

Current lens is attached.

-Doug
(* Parsing /etc/modules.autoload.d/* *)

module ModulesAutoload=
  autoload xfm

  let sep_tab = Util.del_ws_tab
  let sep_spc = Util.del_ws_spc

  let eol = del /[ \t]*\n/ "\n"
  let indent = del /[ \t]*/ ""
  let s = del /[ \t]+/ " "

  let comment = Util.comment
  let word = /[0-9A-Za-z_-]+/
  let optword = /[^ \t\n#:]+/
  let empty   = [ del /[ \t]*#?[ \t]*\n/ "\n" ]

  let opt = store word
  let optval = [ key word . del /=/ "=" . store optword ]

  let record = [ counter "option" . key word .
                 [ seq "option" . s . ( opt | optval ) ]* .
                 eol ]

  let lns = ( empty | comment | record ) *

  test lns get "ip_gre\n" =
    { "ip_gre" }
  test lns get "ip_gre option1\n" =
    { "ip_gre"
      { "1" = "option1" }
    }
  test lns get "ip_gre option1=a\n" =
    { "ip_gre"
      { "1"
        { "option1" = "a" }
      }
    }
  test lns get "ip_gre option1=a=b\n" =
    { "ip_gre"
      { "1"
        { "option1" = "a=b" }
      }
    }
  test lns get "ip_gre option1=a option2\n" =
    { "ip_gre"
      { "1"
        { "option1" = "a" }
      }
      { "2" = "option2" }
    }
  test lns get "ip_gre option1=a option2=b\n" =
    { "ip_gre"
      { "1"
        { "option1" = "a" }
      }
      { "2"
        { "option2" = "b" }
      }
    }
  test lns get "ip_gre option1=a option2 option3=c\n" =
    { "ip_gre"
      { "1"
        { "option1" = "a" }
      }
      { "2" = "option2" }
      { "3"
        { "option3" = "c" }
      }
    }
  test lns get "ip_gre option1=a\n8021q option2=b\n" =
    { "ip_gre"
      { "1"
        { "option1" = "a" }
      }
    }
    { "8021q"
      { "1"
        { "option2" = "b" }
      }
    }
  test lns get "ip_gre option1=a option2 option3=b\n8021q option4=c option5 
option6=d\n" =
    { "ip_gre"
      { "1"
        { "option1" = "a" }
      }
      { "2" = "option2" }
      { "3"
        { "option3" = "b" }
      }
    }
    { "8021q"
      { "1"
        { "option4" = "c" }
      }
      { "2" = "option5" }
      { "3"
        { "option6" = "d" }
      }
    }

  test lns put "" after
    set "/ip_gre" "" 
  = "ip_gre\n"

  test lns put "ip_gre\n" after
    set "/ip_gre/1" "option1" 
  = "ip_gre option1\n"

  test lns put "ip_gre\n" after
    set "/ip_gre/1" "option1" ;
    set "/ip_gre/1/option1" "a"
  = "ip_gre option1=a\n"

  test lns put "ip_gre\n" after
    set "/ip_gre/1" "option1" ;
    set "/ip_gre/1/option1" "a" ;
    set "/ip_gre/2" "option2" ;
    set "/ip_gre/3" "option3" ;
    set "/ip_gre/3/option3" "b" 
  = "ip_gre option1=a option2 option3=b\n"
  
  test lns put "ip_gre option1=a option2 option3=b\n" after
    rm "/ip_gre/1"
  = ?
(*
"ip_gre option2 option3=b\n"
*)

  test lns put "ip_gre option1=a option2 option3=b\n" after
    rm "/ip_gre/2"
  = "ip_gre option1=a option3=b\n"

  let xfm = transform lns (
    incl "/etc/modules.autoload.d/*" .
    Util.stdexcl
  )

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to