1 (* Tests for the Ethers module *)
6 let empty_entries = "# see man ethers for syntax\n"
8 test Ethers.record get empty_entries =
9 { "#comment" = "see man ethers for syntax" }
12 let three_entries = "54:52:00:01:00:01 192.168.1.1
14 54:52:00:01:00:02 foo.example.com
18 test Ethers.lns get three_entries =
19 { "1" { "mac" = "54:52:00:01:00:01" }
20 { "ip" = "192.168.1.1" } }
21 { "#comment" = "comment" }
22 { "2" { "mac" = "54:52:00:01:00:02" }
23 { "ip" = "foo.example.com" } }
24 { "3" { "mac" = "00:16:3e:01:fe:03" }
27 (* Deleting the 'ip' node violates the schema *)
28 test Ethers.lns put three_entries after
32 test Ethers.lns put three_entries after
33 set "/2/ip" "192.168.1.2" ;
35 = "54:52:00:01:00:01 192.168.1.1
37 54:52:00:01:00:02 192.168.1.2
41 test Ethers.lns put three_entries after
43 = "54:52:00:01:00:01 192.168.1.1
45 54:52:00:01:00:02 foo.example.com
48 (* Make sure blank and indented lines get through *)
49 test Ethers.lns get "54:52:00:01:00:01\tfoo \n \n\n
50 54:52:00:01:00:02 bar\n" =
51 { "1" { "mac" = "54:52:00:01:00:01" }
54 { "2" { "mac" = "54:52:00:01:00:02" }
57 (* Local Variables: *)