mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-23 22:06:04 +00:00
test(r): pin that a UTF-8 BOM at the start of an R file indexes and renames
The grammar skips the mark, so the first-line definition, its CALLS edge and the rename all work and the mark is kept. Added as a rename fixture; no code change.
This commit is contained in:
parent
659ec8134d
commit
53bbf3cc1a
4 changed files with 22 additions and 1 deletions
3
gitnexus/test/fixtures/rename-integration/r/source-bom/after/a.R
vendored
Normal file
3
gitnexus/test/fixtures/rename-integration/r/source-bom/after/a.R
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
secret <- function(x) x * 2
|
||||
|
||||
run <- function() secret(2)
|
||||
3
gitnexus/test/fixtures/rename-integration/r/source-bom/before/a.R
vendored
Normal file
3
gitnexus/test/fixtures/rename-integration/r/source-bom/before/a.R
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
helper <- function(x) x * 2
|
||||
|
||||
run <- function() helper(2)
|
||||
15
gitnexus/test/fixtures/rename-integration/r/source-bom/case.json
vendored
Normal file
15
gitnexus/test/fixtures/rename-integration/r/source-bom/case.json
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"language": "r",
|
||||
"description": "A UTF-8 byte order mark at the start of an R file does not break indexing or rename: the definition on the first line is found and renamed with its call, and the mark is kept.",
|
||||
"categories": ["encoding", "positive"],
|
||||
"target": { "name": "helper", "kind": "Function", "file": "a.R", "startLine": 0 },
|
||||
"newName": "secret",
|
||||
"expect": { "status": "success", "edits": 2 },
|
||||
"edges": [
|
||||
{
|
||||
"type": "CALLS",
|
||||
"from": { "name": "run", "kind": "Function", "file": "a.R", "startLine": 2 },
|
||||
"to": { "name": "helper", "kind": "Function", "file": "a.R", "startLine": 0 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import { defineRenameFixtureTests, renameCases } from '../helpers/rename-integra
|
|||
// 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(58);
|
||||
expect(renameCases.filter((fixture) => fixture.language === 'r')).toHaveLength(59);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue