mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-01 07:02:35 +00:00
test(r): pin a cross-file rename, the paste0 gap and the number of R rename cases
The documented claim that a rename succeeds across files had only same-file successes behind it, and the undetected paste0() lookup was unpinned. Add a qualified pkg::name() cross-file rename and a run-time-built lookup name, and count the R cases so that an emptied fixture directory cannot leave the suite green with no test.
This commit is contained in:
parent
209653b861
commit
e8701aa956
13 changed files with 52 additions and 1 deletions
3
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/DESCRIPTION
vendored
Normal file
3
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/DESCRIPTION
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Package: pk
|
||||
Version: 0.1.0
|
||||
Title: Fixture
|
||||
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/NAMESPACE
vendored
Normal file
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/NAMESPACE
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export(g)
|
||||
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/R/f.R
vendored
Normal file
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/R/f.R
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
secret <- function() 1
|
||||
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/R/g.R
vendored
Normal file
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/after/R/g.R
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
g <- function() pk::secret()
|
||||
3
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/DESCRIPTION
vendored
Normal file
3
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/DESCRIPTION
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Package: pk
|
||||
Version: 0.1.0
|
||||
Title: Fixture
|
||||
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/NAMESPACE
vendored
Normal file
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/NAMESPACE
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export(g)
|
||||
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/R/f.R
vendored
Normal file
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/R/f.R
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
hidden <- function() 1
|
||||
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/R/g.R
vendored
Normal file
1
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/before/R/g.R
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
g <- function() pk::hidden()
|
||||
15
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/case.json
vendored
Normal file
15
gitnexus/test/fixtures/rename-integration/r/cross-file-qualified-call/case.json
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"language": "r",
|
||||
"description": "Rename a private package function that another file of the package calls as pkg::name(); the qualified call is a proven binding, so the rename crosses files.",
|
||||
"categories": ["call-graph", "cross-file", "qualified-call", "namespace"],
|
||||
"target": { "name": "hidden", "kind": "Function", "file": "R/f.R", "startLine": 0 },
|
||||
"newName": "secret",
|
||||
"expect": { "status": "success", "edits": 2 },
|
||||
"edges": [
|
||||
{
|
||||
"type": "CALLS",
|
||||
"from": { "name": "g", "kind": "Function", "file": "R/g.R", "startLine": 0 },
|
||||
"to": { "name": "hidden", "kind": "Function", "file": "R/f.R", "startLine": 0 }
|
||||
}
|
||||
]
|
||||
}
|
||||
3
gitnexus/test/fixtures/rename-integration/r/string-built-name/after/dyn.R
vendored
Normal file
3
gitnexus/test/fixtures/rename-integration/r/string-built-name/after/dyn.R
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
job <- function() 1
|
||||
|
||||
run <- function() do.call(paste0("wor", "ker"), list())
|
||||
3
gitnexus/test/fixtures/rename-integration/r/string-built-name/before/dyn.R
vendored
Normal file
3
gitnexus/test/fixtures/rename-integration/r/string-built-name/before/dyn.R
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
worker <- function() 1
|
||||
|
||||
run <- function() do.call(paste0("wor", "ker"), list())
|
||||
9
gitnexus/test/fixtures/rename-integration/r/string-built-name/case.json
vendored
Normal file
9
gitnexus/test/fixtures/rename-integration/r/string-built-name/case.json
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"language": "r",
|
||||
"description": "Rename a function that is looked up only by a name built at run time (paste0); the lookup is not detected, so the rename succeeds and the lookup string keeps the old name. Documented limit.",
|
||||
"categories": ["string-dispatch", "documented-limit"],
|
||||
"target": { "name": "worker", "kind": "Function", "file": "dyn.R", "startLine": 0 },
|
||||
"newName": "job",
|
||||
"expect": { "status": "success", "edits": 1 },
|
||||
"edges": []
|
||||
}
|
||||
|
|
@ -1,3 +1,12 @@
|
|||
import { defineRenameFixtureTests } from '../helpers/rename-integration-cases.js';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { defineRenameFixtureTests, renameCases } from '../helpers/rename-integration-cases.js';
|
||||
|
||||
// The fixture runner builds its test list from the directory, so an empty or renamed directory
|
||||
// would define no test and stay green. Pin the number of R cases: adding one means raising it.
|
||||
describe('R rename fixtures', () => {
|
||||
it('are all discovered', () => {
|
||||
expect(renameCases.filter((fixture) => fixture.language === 'r')).toHaveLength(49);
|
||||
});
|
||||
});
|
||||
|
||||
defineRenameFixtureTests('r');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue