-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: regression of handling of rule file in treesitter-ng.
- Loading branch information
Showing
3 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...est/java/com/github/gumtreediff/gen/treesitterng/PythonTreeSitterNgTreeGeneratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* This file is part of GumTree. | ||
* | ||
* GumTree is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* GumTree is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with GumTree. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright 2022 Jean-Rémy Falleri <[email protected]> | ||
*/ | ||
package com.github.gumtreediff.gen.treesitterng; | ||
|
||
import com.github.gumtreediff.tree.Tree; | ||
import com.github.gumtreediff.tree.TreeContext; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class PythonTreeSitterNgTreeGeneratorTest { | ||
private final PythonTreeSitterNgTreeGenerator generator = new PythonTreeSitterNgTreeGenerator(); | ||
|
||
@Test | ||
public void testString() throws IOException { | ||
TreeContext src = generator.generateFrom().file("testData/python/foo.py"); | ||
assertEquals(12, src.getRoot().getMetrics().size); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
print("foo") | ||
|
||
def bar(i): | ||
return |