Skip to content

Commit c73b05f

Browse files
Add the column back to the expectation_location() (#1721)
Was removed in #1686. Related to rstudio/rstudio#12431
1 parent 7ea2245 commit c73b05f

File tree

8 files changed

+98
-98
lines changed

8 files changed

+98
-98
lines changed

R/expectation.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ expectation_location <- function(x) {
265265
if (identical(filename, "")) {
266266
paste0("Line ", x$srcref[1])
267267
} else {
268-
cli::format_inline("{.file {filename}:{x$srcref[1]}}")
268+
cli::format_inline("{.file {filename}:{x$srcref[1]}:{x$srcref[2]}}")
269269
}
270270
}
271271
}

tests/testthat/_snaps/reporter-check.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
* skip (1)
88

99
== Warnings ====================================================================
10-
-- Warning ('reporters/tests.R:49'): warnings get backtraces -------------------
10+
-- Warning ('reporters/tests.R:49:3'): warnings get backtraces -----------------
1111
def
1212
Backtrace:
1313
1. f()
1414
at reporters/tests.R:49:2
1515

1616
== Failed tests ================================================================
17-
-- Failure ('reporters/tests.R:12'): Failure:1 ---------------------------------
17+
-- Failure ('reporters/tests.R:12:3'): Failure:1 -------------------------------
1818
FALSE is not TRUE
1919

2020
`actual`: FALSE
2121
`expected`: TRUE
22-
-- Failure ('reporters/tests.R:17'): Failure:2a --------------------------------
22+
-- Failure ('reporters/tests.R:17:3'): Failure:2a ------------------------------
2323
FALSE is not TRUE
2424

2525
`actual`: FALSE
@@ -28,9 +28,9 @@
2828
x
2929
1. \-f() at reporters/tests.R:17:2
3030
2. \-testthat::expect_true(FALSE) at reporters/tests.R:16:7
31-
-- Error ('reporters/tests.R:23'): Error:1 -------------------------------------
31+
-- Error ('reporters/tests.R:23:3'): Error:1 -----------------------------------
3232
Error in `eval(code, test_env)`: stop
33-
-- Error ('reporters/tests.R:31'): errors get tracebacks -----------------------
33+
-- Error ('reporters/tests.R:31:3'): errors get tracebacks ---------------------
3434
Error in `h()`: !
3535
Backtrace:
3636
x
@@ -45,7 +45,7 @@
4545
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]
4646

4747
== Failed tests ================================================================
48-
-- Failure ('reporters/long-test.R:2'): That very long test messages are not truncated because they contain useful information that you probably want to read --
48+
-- Failure ('reporters/long-test.R:2:3'): That very long test messages are not truncated because they contain useful information that you probably want to read --
4949
Failure has been forced
5050

5151
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]
@@ -63,19 +63,19 @@
6363
* skip (1)
6464

6565
== Warnings ====================================================================
66-
-- Warning ('reporters/tests.R:49'): warnings get backtraces -------------------
66+
-- Warning ('reporters/tests.R:49:3'): warnings get backtraces -----------------
6767
def
6868
Backtrace:
6969
1. f()
7070
at reporters/tests.R:49:2
7171

7272
== Failed tests ================================================================
73-
-- Failure ('reporters/tests.R:12'): Failure:1 ---------------------------------
73+
-- Failure ('reporters/tests.R:12:3'): Failure:1 -------------------------------
7474
FALSE is not TRUE
7575

7676
`actual`: FALSE
7777
`expected`: TRUE
78-
-- Failure ('reporters/tests.R:17'): Failure:2a --------------------------------
78+
-- Failure ('reporters/tests.R:17:3'): Failure:2a ------------------------------
7979
FALSE is not TRUE
8080

8181
`actual`: FALSE
@@ -84,9 +84,9 @@
8484
x
8585
1. \-f() at reporters/tests.R:17:2
8686
2. \-testthat::expect_true(FALSE) at reporters/tests.R:16:7
87-
-- Error ('reporters/tests.R:23'): Error:1 -------------------------------------
87+
-- Error ('reporters/tests.R:23:3'): Error:1 -----------------------------------
8888
Error in `eval(code, test_env)`: stop
89-
-- Error ('reporters/tests.R:31'): errors get tracebacks -----------------------
89+
-- Error ('reporters/tests.R:31:3'): errors get tracebacks ---------------------
9090
Error in `h()`: !
9191
Backtrace:
9292
x

tests/testthat/_snaps/reporter-junit.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
</testsuite>
88
<testsuite name="Failures" timestamp="1999:12:31 23:59:59" hostname="nodename" tests="2" skipped="0" failures="2" errors="0" time="0">
99
<testcase time="0" classname="Failures" name="Failure_1">
10-
<failure type="failure" message="FALSE is not TRUE ('reporters/tests.R:12')">FALSE is not TRUE
10+
<failure type="failure" message="FALSE is not TRUE ('reporters/tests.R:12:3')">FALSE is not TRUE
1111

1212
`actual`: FALSE
1313
`expected`: TRUE </failure>
1414
</testcase>
1515
<testcase time="0" classname="Failures" name="Failure_2a">
16-
<failure type="failure" message="FALSE is not TRUE ('reporters/tests.R:17')">FALSE is not TRUE
16+
<failure type="failure" message="FALSE is not TRUE ('reporters/tests.R:17:3')">FALSE is not TRUE
1717

1818
`actual`: FALSE
1919
`expected`: TRUE
@@ -26,10 +26,10 @@
2626
</testsuite>
2727
<testsuite name="Errors" timestamp="1999:12:31 23:59:59" hostname="nodename" tests="2" skipped="0" failures="0" errors="2" time="0">
2828
<testcase time="0" classname="Errors" name="Error_1">
29-
<error type="error" message="Error in `eval(code, test_env)`: stop ('reporters/tests.R:23')">Error in `eval(code, test_env)`: stop</error>
29+
<error type="error" message="Error in `eval(code, test_env)`: stop ('reporters/tests.R:23:3')">Error in `eval(code, test_env)`: stop</error>
3030
</testcase>
3131
<testcase time="0" classname="Errors" name="errors_get_tracebacks">
32-
<error type="error" message="Error in `h()`: ! ('reporters/tests.R:31')">Error in `h()`: !
32+
<error type="error" message="Error in `h()`: ! ('reporters/tests.R:31:3')">Error in `h()`: !
3333
Backtrace:
3434
1. f()
3535
at reporters/tests.R:31:2
@@ -41,16 +41,16 @@
4141
</testsuite>
4242
<testsuite name="Skips" timestamp="1999:12:31 23:59:59" hostname="nodename" tests="2" skipped="2" failures="0" errors="0" time="0">
4343
<testcase time="0" classname="Skips" name="explicit_skips_are_reported">
44-
<skipped message="Reason: skip ('reporters/tests.R:37')"/>
44+
<skipped message="Reason: skip ('reporters/tests.R:37:3')"/>
4545
</testcase>
4646
<testcase time="0" classname="Skips" name="empty_tests_are_implicitly_skipped">
47-
<skipped message="Reason: empty test ('reporters/tests.R:40')"/>
47+
<skipped message="Reason: empty test ('reporters/tests.R:40:1')"/>
4848
</testcase>
4949
</testsuite>
5050
<testsuite name="Warnings" timestamp="1999:12:31 23:59:59" hostname="nodename" tests="2" skipped="1" failures="0" errors="0" time="0">
5151
<testcase time="0" classname="Warnings" name="warnings_get_backtraces"/>
5252
<testcase time="0" classname="Warnings" name="warnings_get_backtraces">
53-
<skipped message="Reason: empty test ('reporters/tests.R:45')"/>
53+
<skipped message="Reason: empty test ('reporters/tests.R:45:1')"/>
5454
</testcase>
5555
</testsuite>
5656
</testsuites>
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
# reporter as expected
22

33
Start test: Success
4-
'reporters/tests.R:6' [success]
4+
'reporters/tests.R:6:3' [success]
55
End test: Success
66

77
Start test: Failure:1
8-
'reporters/tests.R:12' [failure]
8+
'reporters/tests.R:12:3' [failure]
99
End test: Failure:1
1010

1111
Start test: Failure:2a
12-
'reporters/tests.R:17' [failure]
12+
'reporters/tests.R:17:3' [failure]
1313
End test: Failure:2a
1414

1515
Start test: Error:1
16-
'reporters/tests.R:23' [error]
16+
'reporters/tests.R:23:3' [error]
1717
End test: Error:1
1818

1919
Start test: errors get tracebacks
20-
'reporters/tests.R:31' [error]
20+
'reporters/tests.R:31:3' [error]
2121
End test: errors get tracebacks
2222

2323
Start test: explicit skips are reported
24-
'reporters/tests.R:37' [skip]
24+
'reporters/tests.R:37:3' [skip]
2525
End test: explicit skips are reported
2626

2727
Start test: empty tests are implicitly skipped
28-
'reporters/tests.R:40' [skip]
28+
'reporters/tests.R:40:1' [skip]
2929
End test: empty tests are implicitly skipped
3030

3131
Start test: warnings get backtraces
32-
'reporters/tests.R:49' [warning]
33-
'reporters/tests.R:45' [skip]
32+
'reporters/tests.R:49:3' [warning]
33+
'reporters/tests.R:45:1' [skip]
3434
End test: warnings get backtraces
3535

3636

0 commit comments

Comments
 (0)