Skip to content

Commit 8cb1751

Browse files
authored
Autocompletion fix and unit test for uut_prototype_stubs (#261)
1 parent c8522c1 commit 8cb1751

File tree

5 files changed

+58
-6
lines changed

5 files changed

+58
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,8 @@ This option is new for VectorCAST 23 sp2
169169

170170
- Implemented ability to load Test Scripts by saving the .tst file
171171

172+
## [1.0.17] - 2025-06-17
173+
174+
### Bug Fixes
175+
- Fixed autocompletion for uut_prototype_stubs.
172176

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vectorcasttestexplorer",
33
"displayName": "VectorCAST Test Explorer",
44
"description": "VectorCAST Test Explorer for VS Code",
5-
"version": "1.0.16",
5+
"version": "1.0.17",
66
"license": "MIT",
77
"repository": {
88
"type": "git",

python/tstUtilities.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,8 @@ def getFunctionList(api, unitName):
358358
# coded_tests_driver because this function is supporting
359359
# TEST.VALUE and TEST.EXPECTED lines.
360360
if (
361-
isTestableFunction(function)
362-
and function.vcast_name != CODED_TEST_SUBPROGRAM_NAME
363-
):
361+
unitName == PROTOTYPE_STUB_VCAST_NAME or isTestableFunction(function)
362+
) and function.vcast_name != CODED_TEST_SUBPROGRAM_NAME:
364363
returnList.append(function.vcast_name)
365364

366365
if len(unitObject.globals) > 0:

tests/unit/resources/unit.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,21 @@ enum Color { red, green, blue };
88
Color r = red;
99

1010
int global = 20;
11+
12+
int external_add(int, int);
13+
void log_result(int);
14+
1115
int bar(int z){
1216
int x = 1;
1317
int y = 2;
18+
1419
if (x > loc.x)
1520
return x;
1621

1722
if (x + y > z)
18-
return z;
19-
23+
return external_add(x, y);
24+
25+
log_result(z);
26+
2027
return x + y + global;
2128
}

tests/unit/tst-completion.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ TEST.NOTES:
9494
TEST.END_NOTES:
9595
TEST.END`;
9696

97+
const uutPrototypeTst = `
98+
TEST.NEW
99+
TEST.NAME:valueHover
100+
TEST.VALUE:uut_prototype_stubs.
101+
TEST.NOTES:
102+
TEST.END_NOTES:
103+
TEST.END`;
104+
97105
const fieldTst = `
98106
TEST.NEW
99107
TEST.NAME:fieldTest
@@ -746,6 +754,40 @@ describe("Text Completion", () => {
746754
timeout
747755
);
748756

757+
test(
758+
"validate tst completion for TEST.VALUE:uut_prototype_stubs.",
759+
async () => {
760+
const tstText = [initialTst, uutPrototypeTst].join("\n");
761+
const lineToComplete = "TEST.VALUE:uut_prototype_stubs.";
762+
const completionPosition = getCompletionPositionForLine(
763+
lineToComplete,
764+
tstText
765+
);
766+
const triggerCharacter = lineToComplete.at(-1);
767+
768+
const generatedCompletionData = await generateCompletionData(
769+
tstText,
770+
completionPosition,
771+
triggerCharacter
772+
);
773+
expect(generatedCompletionData).toEqual([
774+
{
775+
data: 0,
776+
detail: "",
777+
kind: 3,
778+
label: "external_add",
779+
},
780+
{
781+
data: 1,
782+
detail: "",
783+
kind: 3,
784+
label: "log_result",
785+
},
786+
]);
787+
},
788+
timeout
789+
);
790+
749791
test(
750792
"validate tst completion for TEST.VALUE:unit.<<GLOBAL>>.loc. field",
751793
async () => {

0 commit comments

Comments
 (0)