File: pass_read_file.aug

package info (click to toggle)
augeas 0.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 8,216 kB
  • ctags: 5,097
  • sloc: ansic: 48,281; sh: 11,387; cpp: 624; yacc: 515; ruby: 444; makefile: 319; lex: 198; perl: 27; pascal: 27
file content (15 lines) | stat: -rw-r--r-- 535 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Pass_read_file =

(* This is a roundabout way to test that Sys.getenv and Sys.read_file *)
(* work. Since we don't have a generic unit testing facility, we need *)
(* to phrase things in terms of a lens test.                          *)

let fname = (Sys.getenv "abs_top_srcdir") . "/tests/root/pairs.txt"
let str = (Sys.read_file fname)
let lns = [ key /[a-z0-9]*/ . del /[ \t]*=[ \t]*/ "="
    . store /[^ \t\n]*/ . del /\n/ "\n" ] *

test lns get str =
  { "key1" = "value1" }
  { "key2" = "value2" }
  { "key3" = "value3" }