- Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-enhancementNew feature, improvement or change requestNew feature, improvement or change request
Description
Currently some unused variables are generated for expected field values in tests. They are not involved in asserts later.
For example, generate tests for ArraysOverwriteValue.objectArray from our samples.
@Test @DisplayName("objectArray: a[0] == null : True -> return 2") public void testObjectArray_0OfAEqualsNull() throws Throwable { ArraysOverwriteValue arraysOverwriteValue = new ArraysOverwriteValue(); ObjectWithPrimitivesClass[] objectWithPrimitivesClassArray = new ObjectWithPrimitivesClass[1]; //NOTE: this field is unused, we should not generate it. ObjectWithPrimitivesClass initialObjectWithPrimitivesClassArray0 = objectWithPrimitivesClassArray[0]; int actual = arraysOverwriteValue.objectArray(objectWithPrimitivesClassArray); assertEquals(2, actual); ObjectWithPrimitivesClass finalObjectWithPrimitivesClassArray0 = objectWithPrimitivesClassArray[0]; assertNull(finalObjectWithPrimitivesClassArray0); }
We should avoid unused fields an corresponding warnings.
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-enhancementNew feature, improvement or change requestNew feature, improvement or change request
Type
Projects
Status
Done