File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
src/test/java/io/github/treesitter/jtreesitter Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,7 @@ void setUp() {
3131
3232 @ AfterEach
3333 void tearDown () {
34- if (cursor != null ){
35- cursor .close ();
36- }
34+ cursor .close ();
3735 }
3836
3937 @ Test
@@ -44,16 +42,15 @@ void getCurrentNode() {
4442
4543 @ Test
4644 void getCurrentNodeWithCustomAllocator () {
47-
48- try ( var arena = Arena . ofConfined ()){
49- var node = cursor .getCurrentNode ( arena );
50- assertEquals ( tree . getRootNode (), node );
51- cursor . close ( );
52- cursor = null ; // avoid double close
45+ try ( var arena = Arena . ofConfined ()) {
46+ Node node ;
47+ try ( TreeCursor copied = cursor .clone ()) {
48+ node = copied . getCurrentNode ( arena );
49+ assertEquals ( tree . getRootNode (), node );
50+ }
5351 // can still access node after cursor was closed
5452 assertEquals (tree .getRootNode (), node );
5553 }
56-
5754 }
5855
5956 @ Test
You can’t perform that action at this time.
0 commit comments