feat: enhance JavaScript test snippet with class and module exports

This commit is contained in:
Paul Gauthier (aider) 2024-11-27 06:48:12 -08:00
parent 2337b2bb3e
commit 27f0ca3b08

View file

@ -407,8 +407,34 @@ class TestRepoMapAllLanguages(unittest.TestCase):
),
"javascript": (
"test.js",
"var greet= 1;function greet(name) {\n console.log(`Hello, ${name}!`);\n}\n",
"greet", # Key symbol to check
"""// Class definition
class Person {
constructor(name) {
this.name = name;
}
sayHello() {
return `Hello, ${this.name}!`;
}
}
// Function declaration
function greet(person) {
return person.sayHello();
}
// Variables and constants
const DEFAULT_NAME = 'World';
let currentPerson = new Person(DEFAULT_NAME);
// Export for use in other modules
module.exports = {
Person,
greet,
DEFAULT_NAME
};
""",
"Person", # Key symbol to check
),
"ocaml": (
"test.ml",