(t *testing.T)
| 33 | } |
| 34 | |
| 35 | func TestDetectCodeLanguage(t *testing.T) { |
| 36 | cases := map[string]string{ |
| 37 | "package main\nfunc main() {}": "go", |
| 38 | "def hello():\n print('hi')": "python", |
| 39 | "import os\nprint(os.getcwd())": "python", |
| 40 | "const x = 42\nlet y = x + 1": "javascript", |
| 41 | "#include <stdio.h>\nint main() {}": "c", |
| 42 | "public class Main {}": "java", |
| 43 | "fn main() { println!(\"hi\"); }": "rust", |
| 44 | } |
| 45 | for code, expected := range cases { |
| 46 | if result := detectCodeLanguage(code); result != expected { |
| 47 | t.Errorf("detectCodeLanguage(%q...) = %q, want %q", code[:15], result, expected) |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestStructuralLintBalanced(t *testing.T) { |
| 53 | block := CodeBlock{Language: "go", Code: "func main() {\n\tfmt.Println(\"hi\")\n}"} |
nothing calls this directly
no test coverage detected