This file is indexed.

/usr/share/doc/r-cran-r.utils/tests/mout.R is in r-cran-r.utils 2.5.0-1.

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
library("R.utils")
show <- methods::show

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# General tests
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
x <- letters[1:8]
x2 <- c(x[-1], "\n")
x3 <- x2[-1]
y <- as.list(x[1:3])

cat("mprint():\n")
print(x)
mprint(x)

print(y)
mprint(y)

cat("mcat():\n")
cat(x, "\n")
mcat(x, "\n")

cat(x2)
mcat(x2)

cat(x3, sep=",")
mcat(x3, sep=",")

cat(x3, sep="\n")
mcat(x3, sep="\n")


cat("mstr():\n")
str(x)
mstr(x)

str(y)
mstr(y)

cat("mshow():\n")
show(x)
mshow(x)

show(y)
mshow(y)

cat("mprintf():\n")
printf("x=%d\n", 1:3)
mprintf("x=%d\n", 1:3)

cat("mout():\n")
writeLines(x)
mout(writeLines(x))


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Tests related to closure
# - - - - - - - - - - - -- - - - - - - - - - - - - - - - - -
mfoo <- function(a=1) {
  mprintf("a=%s\n", a)
}

mbar <- function(...) {
  mfoo(...)
}

a <- 2
mfoo(a)
mfoo(3)

mbar(a)
mbar(3)



# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Assert that "console" messages can be captured/sunk
# via stderr but not stdout
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
res <- captureOutput({ mcat("Hello") })
str(res)
stopifnot(length(res) == 0L)

withSink({ mcat("Hello") }, file="foo.txt", type="message")
res <- readLines("foo.txt")
str(res)
stopifnot(length(res) > 0L)