Recognize Java method fragments without package declarations

This commit is contained in:
evgeny committed 2026-11-02 23:09:33 +01:00
1 parent 34b71c040e
commit bf663d5799
2 files changed
+4 -2

No files matched your search

@@ -18,6 +18,8 @@ private slots:
QTest::newRow("c") << "#include <stdio.h>\nint main(void) { puts(\"hello\"); }" << "C";
QTest::newRow("cpp") << "#include <stdio.h>\nint main() { std::cout << 42; }" << "C++";
QTest::newRow("java") << "package example;\npublic class Hello { public static void main(String[] args) {} }" << "Java";
QTest::newRow("java-method") << "public static Result parse(String input) { return new Result(input); }" << "Java";
QTest::newRow("cpp-method") << "class Example { public: void run() {} };" << "C++";
QTest::newRow("kotlin") << "fun main() { println(\"hello\") }" << "Kotlin";
QTest::newRow("rust") << "fn main() { println!(\"hello\"); }" << "Rust";
QTest::newRow("rust-std") << "use std::{borrow::Cow, collections::BTreeSet};" << "Rust";