-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(code2prompt/utils): update is_filtered function to handle exclude…
… patterns, add tests for syntax map (#19)
- Loading branch information
1 parent
9e17676
commit 3b377ba
Showing
4 changed files
with
63 additions
and
38 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
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
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
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 |
---|---|---|
@@ -1,27 +1,29 @@ | ||
import pytest | ||
from code2prompt.utils.language_inference import infer_language | ||
|
||
def test_infer_language(): | ||
""" Test the infer_language function.""" | ||
assert infer_language("main.c") == "c" | ||
assert infer_language("main.cpp") == "cpp" | ||
assert infer_language("Main.java") == "java" | ||
assert infer_language("script.js") == "javascript" | ||
assert infer_language("Program.cs") == "csharp" | ||
assert infer_language("index.php") == "php" | ||
assert infer_language("main.go") == "go" | ||
assert infer_language("lib.rs") == "rust" | ||
assert infer_language("app.kt") == "kotlin" | ||
assert infer_language("main.swift") == "swift" | ||
assert infer_language("Main.scala") == "scala" | ||
assert infer_language("main.dart") == "dart" | ||
assert infer_language("script.py") == "python" | ||
assert infer_language("script.rb") == "ruby" | ||
assert infer_language("script.pl") == "perl" | ||
assert infer_language("script.sh") == "bash" | ||
assert infer_language("script.ps1") == "powershell" | ||
assert infer_language("index.html") == "html" | ||
assert infer_language("data.xml") == "xml" | ||
assert infer_language("query.sql") == "sql" | ||
assert infer_language("script.m") == "matlab" | ||
assert infer_language("script.r") == "r" | ||
assert infer_language("file.txt") == "plaintext" | ||
syntax_map = {} # Define the syntax map as needed | ||
assert infer_language("main.c", syntax_map) == "c" # Added syntax_map argument | ||
assert infer_language("main.cpp", syntax_map) == "cpp" | ||
assert infer_language("Main.java", syntax_map) == "java" | ||
assert infer_language("script.js", syntax_map) == "javascript" | ||
assert infer_language("Program.cs", syntax_map) == "csharp" | ||
assert infer_language("index.php", syntax_map) == "php" | ||
assert infer_language("main.go", syntax_map) == "go" | ||
assert infer_language("lib.rs", syntax_map) == "rust" | ||
assert infer_language("app.kt", syntax_map) == "kotlin" | ||
assert infer_language("main.swift", syntax_map) == "swift" | ||
assert infer_language("Main.scala", syntax_map) == "scala" | ||
assert infer_language("main.dart", syntax_map) == "dart" | ||
assert infer_language("script.py", syntax_map) == "python" | ||
assert infer_language("script.rb", syntax_map) == "ruby" | ||
assert infer_language("script.pl", syntax_map) == "perl" | ||
assert infer_language("script.sh", syntax_map) == "bash" | ||
assert infer_language("script.ps1", syntax_map) == "powershell" | ||
assert infer_language("index.html", syntax_map) == "html" | ||
assert infer_language("data.xml", syntax_map) == "xml" | ||
assert infer_language("query.sql", syntax_map) == "sql" | ||
assert infer_language("script.m", syntax_map) == "matlab" | ||
assert infer_language("script.r", syntax_map) == "r" | ||
assert infer_language("file.txt", syntax_map) == "plaintext" |