Skip to content

Commit

Permalink
Add gtkbookmarks.aug and test
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink committed Sep 3, 2012
1 parent c6cd40a commit 131f6e6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/naturaldocs/conf/lenses/Menu.txt
Expand Up @@ -75,6 +75,7 @@ Group: Specific Modules {
File: Fonts (fonts.aug) File: Fonts (fonts.aug)
File: Fuse (fuse.aug) File: Fuse (fuse.aug)
File: Grub (grub.aug) File: Grub (grub.aug)
File: GtkBookmarks (gtkbookmarks.aug)
File: Hostname (hostname.aug) File: Hostname (hostname.aug)
File: Hosts_Access (hosts_access.aug) File: Hosts_Access (hosts_access.aug)
File: Host_Conf (host_conf.aug) File: Host_Conf (host_conf.aug)
Expand Down Expand Up @@ -129,6 +130,7 @@ Group: Specific Modules {
File: Qpid (qpid.aug) File: Qpid (qpid.aug)
File: Systemd (systemd.aug) File: Systemd (systemd.aug)
File: Vfstab (vfstab.aug) File: Vfstab (vfstab.aug)
File: Ldif (ldif.aug)
} # Group: Specific Modules } # Group: Specific Modules


Group: Generic Modules { Group: Generic Modules {
Expand All @@ -149,6 +151,7 @@ Group: Tests and Examples {
File: Test_Channels (tests/test_channels.aug) File: Test_Channels (tests/test_channels.aug)
File: Test_Cups (tests/test_cups.aug) File: Test_Cups (tests/test_cups.aug)
File: Test_Fuse (tests/test_fuse.aug) File: Test_Fuse (tests/test_fuse.aug)
File: Test_GtkBookmarks (tests/test_gtkbookmarks.aug)
File: Test_IniFile (tests/test_inifile.aug) File: Test_IniFile (tests/test_inifile.aug)
File: Test_Inputrc (tests/test_inputrc.aug) File: Test_Inputrc (tests/test_inputrc.aug)
File: Test_Keepalived (tests/test_keepalived.aug) File: Test_Keepalived (tests/test_keepalived.aug)
Expand Down
32 changes: 32 additions & 0 deletions lenses/gtkbookmarks.aug
@@ -0,0 +1,32 @@
(*
Module: GtkBookmarks
Parses $HOME/.gtk-bookmarks

Author: Raphael Pinson <raphael.pinson@camptocamp.com>

About: License
This file is licenced under the LGPL v2+, like the rest of Augeas.

About: Lens Usage
To be documented

About: Configuration files
This lens applies to $HOME/.gtk-bookmarks. See <filter>.

About: Examples
The <Test_GtkBookmarks> file contains various examples and tests.
*)
module GtkBookmarks =

autoload xfm

(* View: entry *)
let entry = [ seq "entry" . store Rx.no_spaces
. (Sep.space . [ label "label" . store Rx.space_in ])?
. Util.eol ]

(* View: lns *)
let lns = entry*

(* View: xfm *)
let xfm = transform lns (incl (Sys.getenv("HOME") . "/.gtk-bookmarks"))
17 changes: 17 additions & 0 deletions lenses/tests/test_gtkbookmarks.aug
@@ -0,0 +1,17 @@
(*
Module: Test_GtkBookmarks
Provides unit tests and examples for the <GtkBookmarks> lens.
*)

module Test_GtkBookmarks =

(* Test: GtkBookmarks.lns
Test without label *)
test GtkBookmarks.lns get "ftp://user@myftp.com/somedir\n" =
{ "1" = "ftp://user@myftp.com/somedir" }

(* Test: GtkBookmarks.lns
Test with label *)
test GtkBookmarks.lns get "file:///home/rpinson/Ubuntu%20One Ubuntu One\n" =
{ "1" = "file:///home/rpinson/Ubuntu%20One"
{ "label" = "Ubuntu One" } }
1 change: 1 addition & 0 deletions tests/Makefile.am
Expand Up @@ -57,6 +57,7 @@ lens_tests = \
lens-fuse.sh \ lens-fuse.sh \
lens-gdm.sh \ lens-gdm.sh \
lens-group.sh \ lens-group.sh \
lens-gtkbookmarks.sh \
lens-json.sh \ lens-json.sh \
lens-hostname.sh \ lens-hostname.sh \
lens-hosts.sh \ lens-hosts.sh \
Expand Down

0 comments on commit 131f6e6

Please sign in to comment.