This file is indexed.

/usr/share/augeas/lenses/dist/tests/test_build.aug is in augeas-lenses 1.2.0-0ubuntu1.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
(*
Module: Test_Build
  Provides unit tests and examples for the <Build> lens.
*)

module Test_Build =

(************************************************************************
 * Group:               GENERIC CONSTRUCTIONS
 ************************************************************************)

(* View: brackets
    Test brackets *)
let brackets = [ Build.brackets Sep.lbracket Sep.rbracket  (key Rx.word) ]

(* Test: brackets *)
test brackets get "(foo)" = { "foo" }


(************************************************************************
 * Group:             LIST CONSTRUCTIONS
 ************************************************************************)

(* View: list *)
let list = Build.list [ key Rx.word ] Sep.space

(* Test: list *)
test list get "foo bar baz" = { "foo" } { "bar" } { "baz" }

(* Test: list *)
test list get "foo" = * 

(* View: opt_list *)
let opt_list = Build.opt_list [ key Rx.word ] Sep.space

(* Test: opt_list *)
test opt_list get "foo bar baz" = { "foo" } { "bar" } { "baz" }


(************************************************************************
 * Group:                   LABEL OPERATIONS
 ************************************************************************)

(* View: xchg *)
let xchg = [ Build.xchg Rx.space " " "space" ]

(* Test: xchg *)
test xchg get " \t " = { "space" }

(* View: xchgs *)
let xchgs = [ Build.xchgs " " "space" ]

(* Test: xchgs *)
test xchgs get " " = { "space" }


(************************************************************************
 * Group:                   SUBNODE CONSTRUCTIONS
 ************************************************************************)

(* View: key_value_line *)
let key_value_line = Build.key_value_line Rx.word Sep.equal (store Rx.word)

(* Test: key_value_line *)
test key_value_line get "foo=bar\n" = { "foo" = "bar" }

(* View: key_value_line_comment *)
let key_value_line_comment = Build.key_value_line_comment Rx.word
                             Sep.equal (store Rx.word) Util.comment

(* Test: key_value_line_comment *)
test key_value_line_comment get "foo=bar # comment\n" =
    { "foo" = "bar" { "#comment" = "comment" } }

(* View: key_value *)
let key_value = Build.key_value Rx.word Sep.equal (store Rx.word)

(* Test: key_value *)
test key_value get "foo=bar" = { "foo" = "bar" }

(* View: key_ws_value *)
let key_ws_value = Build.key_ws_value Rx.word

(* Test: key_ws_value *)
test key_ws_value get "foo bar\n" = { "foo" = "bar" }

(* View: flag *)
let flag = Build.flag Rx.word

(* Test: flag *)
test flag get "foo" = { "foo" }

(* View: flag_line *)
let flag_line = Build.flag_line Rx.word

(* Test: flag_line *)
test flag_line get "foo\n" = { "foo" }


(************************************************************************
 * Group:                   BLOCK CONSTRUCTIONS
 ************************************************************************)

(* View: block_entry
    The block entry used for testing *)
let block_entry = Build.key_value "test" Sep.equal (store Rx.word)

(* View: block
    The block used for testing *)
let block = Build.block block_entry

(* Test: block
     Simple test for <block> *)
test block get " {test=1}" =
  { "test" = "1" }

(* Test: block
     Simple test for <block> with newlines *)
test block get " {\n test=1\n}" =
  { "test" = "1" }

(* Test: block
     Simple test for <block> two indented entries *)
test block get " {\n test=1 \n  test=2 \n}" =
  { "test" = "1" }
  { "test" = "2" }

(* Test: block
     Test <block> with a comment *)
test block get " { # This is a comment\n}" =
  { "#comment" = "This is a comment" }

(* Test: block
     Test <block> with comments and newlines *)
test block get " { # This is a comment\n# Another comment\n}" =
  { "#comment" = "This is a comment" }
  { "#comment" = "Another comment" }

(* Test: block
     Test defaults for blocks *)
test block put " { test=1 }" after
   set "/#comment" "a comment";
   rm "/test";
   set "/test" "2" =
  " { # a comment\ntest=2 }"

(* View: named_block
    The named block used for testing *)
let named_block = Build.named_block "foo" block_entry

(* Test: named_block
     Simple test for <named_block> *)
test named_block get "foo {test=1}\n" =
  { "foo" { "test" = "1" } }

(* View: logrotate_block
    A minimalistic logrotate block *)
let logrotate_block =
      let entry = [ key Rx.word ] 
   in let filename = [ label "file" . store /\/[^,#= \n\t{}]+/ ]
   in let filename_sep = del /[ \t\n]+/ " "
   in let filenames = Build.opt_list filename filename_sep
   in [ label "rule" . filenames . Build.block entry ]

(* Test: logrotate_block *)
test logrotate_block get "/var/log/wtmp\n/var/log/wtmp2\n{
   missingok
   monthly
}" =
  { "rule"
    { "file" = "/var/log/wtmp" }
    { "file" = "/var/log/wtmp2" }
    { "missingok" }
    { "monthly" }
  }


(************************************************************************
 * Group:               COMBINATORICS
 ************************************************************************)

(* View: combine_two
    A minimalistic combination lens *)
let combine_two =
     let entry (k:string) = [ key k ]
  in Build.combine_two (entry "a") (entry "b")

(* Test: combine_two 
     Should parse ab *)
test combine_two get "ab" = { "a" } { "b" }

(* Test: combine_two 
     Should parse ba *)
test combine_two get "ba" = { "b" } { "a" }

(* Test: combine_two 
     Should not parse a *)
test combine_two get "a" = *

(* Test: combine_two 
     Should not parse b *)
test combine_two get "b" = *

(* Test: combine_two 
     Should not parse aa *)
test combine_two get "aa" = *

(* Test: combine_two 
     Should not parse bb *)
test combine_two get "bb" = *
 

(* View: combine_two_opt
    A minimalistic optional combination lens *)
let combine_two_opt =
     let entry (k:string) = [ key k ]
  in Build.combine_two_opt (entry "a") (entry "b")

(* Test: combine_two_opt 
     Should parse ab *)
test combine_two_opt get "ab" = { "a" } { "b" }

(* Test: combine_two_opt 
     Should parse ba *)
test combine_two_opt get "ba" = { "b" } { "a" }

(* Test: combine_two_opt 
     Should parse a *)
test combine_two_opt get "a" = { "a" }

(* Test: combine_two_opt 
     Should parse b *)
test combine_two_opt get "b" = { "b" }

(* Test: combine_two_opt 
     Should not parse aa *)
test combine_two_opt get "aa" = *

(* Test: combine_two_opt 
     Should not parse bb *)
test combine_two_opt get "bb" = *


(* View: combine_three
    A minimalistic optional combination lens *)
let combine_three =
     let entry (k:string) = [ key k ]
  in Build.combine_three (entry "a") (entry "b") (entry "c")

(* Test: combine_three 
     Should not parse ab *)
test combine_three get "ab" = *

(* Test: combine_three 
     Should not parse ba *)
test combine_three get "ba" = *

(* Test: combine_three 
     Should not parse a *)
test combine_three get "a" = *

(* Test: combine_three 
     Should not parse b *)
test combine_three get "b" = *

(* Test: combine_three 
     Should not parse aa *)
test combine_three get "aa" = *

(* Test: combine_three 
     Should not parse bbc *)
test combine_three get "bbc" = *

(* Test: combine_three 
     Should parse abc *)
test combine_three get "abc" = { "a" } { "b" } { "c" }

(* Test: combine_three 
     Should parse cab *)
test combine_three get "cab" = { "c" } { "a" } { "b" }


(* View: combine_three_opt
    A minimalistic optional combination lens *)
let combine_three_opt =
     let entry (k:string) = [ key k ]
  in Build.combine_three_opt (entry "a") (entry "b") (entry "c")

(* Test: combine_three_opt 
     Should parse ab *)
test combine_three_opt get "ab" = { "a" } { "b" }

(* Test: combine_three_opt 
     Should parse ba *)
test combine_three_opt get "ba" = { "b" } { "a" }

(* Test: combine_three_opt 
     Should parse a *)
test combine_three_opt get "a" = { "a" }

(* Test: combine_three_opt 
     Should parse b *)
test combine_three_opt get "b" = { "b" }

(* Test: combine_three_opt 
     Should not parse aa *)
test combine_three_opt get "aa" = *

(* Test: combine_three_opt 
     Should not parse bbc *)
test combine_three_opt get "bbc" = *

(* Test: combine_three_opt 
     Should parse abc *)
test combine_three_opt get "abc" = { "a" } { "b" } { "c" }

(* Test: combine_three_opt 
     Should parse cab *)
test combine_three_opt get "cab" = { "c" } { "a" } { "b" }