Skip to content

Commit c00ced8

Browse files
committed
Test files module
1 parent fe0bd8b commit c00ced8

File tree

6 files changed

+97
-0
lines changed

6 files changed

+97
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace Burger
2+
{
3+
public class Steak { }
4+
public class Salad { }
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class User
2+
{
3+
public string Name { get; set; }
4+
private string Password { get; set; }
5+
string Email { get; set; }
6+
}
7+
public struct Order
8+
{
9+
public int OrderId;
10+
public string Description;
11+
}
12+
public enum OrderStatus
13+
{
14+
Pending,
15+
Completed
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace MyNamespace
2+
{
3+
public class MyClass
4+
{
5+
public void MyMethod()
6+
{
7+
Console.WriteLine("MyMethod");
8+
}
9+
}
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
namespace HalfNamespace
2+
{
3+
public class Gordon
4+
{
5+
public void Crowbar()
6+
{
7+
Console.WriteLine("MyMethod");
8+
}
9+
}
10+
}
11+
12+
public class Freeman
13+
{
14+
public void Shotgun()
15+
{
16+
Console.WriteLine("MyMethod");
17+
}
18+
}
19+
20+
class HeadCrab
21+
{
22+
public void Bite()
23+
{
24+
Console.WriteLine("Bite lol");
25+
}
26+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class FarWest
2+
{
3+
public static int cowboy = 66;
4+
}
5+
6+
class EastCoast
7+
{
8+
public static int lobster = 99;
9+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as fs from "fs";
2+
import * as path from "path";
3+
import Parser from "tree-sitter";
4+
import { csharpParser } from "../../../helpers/treeSitter/parsers";
5+
6+
const csharpFilesFolder = path.join(__dirname, "csharpFiles");
7+
8+
const csharpFilesMap = new Map<
9+
string,
10+
{ path: string; rootNode: Parser.SyntaxNode }
11+
>();
12+
13+
function findCSharpFiles(dir: string) {
14+
const files = fs.readdirSync(dir);
15+
files.forEach((file) => {
16+
const fullPath = path.join(dir, file);
17+
const stat = fs.statSync(fullPath);
18+
if (stat.isDirectory()) {
19+
findCSharpFiles(fullPath);
20+
} else if (path.extname(fullPath) === ".cs") {
21+
const content = fs.readFileSync(fullPath, "utf8");
22+
const tree = csharpParser.parse(content);
23+
csharpFilesMap.set(file, { path: file, rootNode: tree.rootNode });
24+
}
25+
});
26+
}
27+
28+
export function getCSharpFilesMap() {
29+
findCSharpFiles(csharpFilesFolder);
30+
return csharpFilesMap;
31+
}

0 commit comments

Comments
 (0)