MCPcopy Create free account
hub / github.com/atripati/ark / TestDetectCodeLanguage

Function TestDetectCodeLanguage

pkg/runtime/verify_test.go:35–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func 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
52func TestStructuralLintBalanced(t *testing.T) {
53 block := CodeBlock{Language: "go", Code: "func main() {\n\tfmt.Println(\"hi\")\n}"}

Callers

nothing calls this directly

Calls 1

detectCodeLanguageFunction · 0.85

Tested by

no test coverage detected