module Test_ModulesAutoload=

  test ModulesAutoload.lns get "ip_gre\n" =
    { "ip_gre" }

  test ModulesAutoload.lns get "ip_gre option1\n" =
    { "ip_gre"
      { "option1" }
    }

  test ModulesAutoload.lns get "ip_gre option1=a\n" =
    { "ip_gre"
      { "option1" = "a" }
    }

  test ModulesAutoload.lns get "ip_gre option1=a=b\n" =
    { "ip_gre"
      { "option1" = "a=b" }
    }

  test ModulesAutoload.lns get "ip_gre option1=a option2\n" =
    { "ip_gre"
      { "option1" = "a" }
      { "option2" }
    }

  test ModulesAutoload.lns get "ip_gre option1=a option2=b\n" =
    { "ip_gre"
      { "option1" = "a" }
      { "option2" = "b" }
    }

  test ModulesAutoload.lns get "ip_gre option1=a option2 option3=c\n" =
    { "ip_gre"
      { "option1" = "a" }
      { "option2" }
      { "option3" = "c" }
    }

  test ModulesAutoload.lns get "ip_gre option1=a\n8021q option2=b\n" =
    { "ip_gre"
      { "option1" = "a" }
    }
    { "8021q"
      { "option2" = "b" }
    }

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

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

  test ModulesAutoload.lns put "ip_gre\n" after
    set "/ip_gre/option1" "a"
  = "ip_gre option1=a\n"

  test ModulesAutoload.lns put "ip_gre\n" after
    set "/ip_gre/option1" "a=b"
  = "ip_gre option1=a=b\n"

  test ModulesAutoload.lns put "ip_gre option1=a\n" after
    set "/ip_gre/option2" ""
  = "ip_gre option1=a option2\n"

  test ModulesAutoload.lns put "ip_gre\n" after
    set "/ip_gre/option1" "a" ;
    set "/ip_gre/option3" "b" 
  = "ip_gre option1=a option3=b\n"
  
  test ModulesAutoload.lns put "ip_gre option1=a option2 option3=b\n" after
    rm "/ip_gre/option1"
  = "ip_gre option2 option3=b\n"

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

