blob: 5359ea2bdcfd84b8c291f342031a598e51c6dbfb (
plain)
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
|
(load "../common")
(push-after-load
(each ((f '#"file1.out file2.out file3.out"))
(remove-path f)))
(file-put-lines "file1.out" '("old"))
(file-put-lines "file2.out" '("old"))
(awk
(:begin (->> "file1.out" (prn "abc"))
(->> "file1.out" (prn "def"))))
(test
(file-get-lines "file1.out")
#"old abc def")
(awk
(:begin (-> "file2.out" (prn "abc"))
(-> "file2.out" (prn "def"))))
(test
(file-get-lines "file2.out")
#"abc def")
(test
(build
(awk
(:begin (<- "file1.out" (add (get-line)))
(<- "file1.out" (add (get-line))))))
#"old abc")
(awk (:begin (!> "cat > file3.out" (prn "out"))))
(test (file-get-string "file3.out") "out\n")
(test
(build
(awk
(:begin (<! "cat file3.out" (add (get-line))))))
#"out")
|