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
@@ -45,16 +43,15 @@ void getCurrentNode() {
4543
4644 @ Test
4745 void getCurrentNodeWithCustomAllocator () {
48-
49- try ( var arena = Arena . ofConfined ()){
50- var node = cursor .getCurrentNode ( arena );
51- assertEquals ( tree . getRootNode (), node );
52- cursor . close ( );
53- cursor = null ; // avoid double close
46+ try ( var arena = Arena . ofConfined ()) {
47+ Node node ;
48+ try ( TreeCursor copied = cursor .clone ()) {
49+ node = copied . getCurrentNode ( arena );
50+ assertEquals ( tree . getRootNode (), node );
51+ }
5452 // can still access node after cursor was closed
5553 assertEquals (tree .getRootNode (), node );
5654 }
57-
5855 }
5956
6057 @ Test
You can’t perform that action at this time.
0 commit comments