mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 21:34:59 +00:00
test: enhance TSX test fixture with more symbols and hooks
This commit is contained in:
parent
10877a99f1
commit
ae395fbb8f
1 changed files with 32 additions and 6 deletions
|
@ -563,12 +563,38 @@ fn main() {
|
||||||
),
|
),
|
||||||
"tsx": (
|
"tsx": (
|
||||||
"test.tsx",
|
"test.tsx",
|
||||||
(
|
"""import React, { useState, useEffect } from 'react';
|
||||||
"import React from 'react';\n\nconst Greeting: React.FC<{ name: string }> = ({"
|
|
||||||
" name }) => {\n return <h1>Hello, {name}!</h1>;\n};\n\nexport default"
|
interface UserProps {
|
||||||
" Greeting;\n"
|
name: string;
|
||||||
),
|
age?: number;
|
||||||
"Greeting", # Key symbol to check
|
}
|
||||||
|
|
||||||
|
// Component with props interface
|
||||||
|
const UserGreeting: React.FC<UserProps> = ({ name, age }) => {
|
||||||
|
const [greeting, setGreeting] = useState<string>('');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setGreeting(`Hello, ${name}${age ? ` (${age})` : ''}!`);
|
||||||
|
}, [name, age]);
|
||||||
|
|
||||||
|
return <h1>{greeting}</h1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Custom hook
|
||||||
|
function useCounter(initial: number = 0) {
|
||||||
|
const [count, setCount] = useState(initial);
|
||||||
|
const increment = () => setCount(c => c + 1);
|
||||||
|
return { count, increment };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
const DEFAULT_NAME = 'World';
|
||||||
|
const MAX_AGE = 150;
|
||||||
|
|
||||||
|
export { UserGreeting, useCounter, DEFAULT_NAME, MAX_AGE };
|
||||||
|
""",
|
||||||
|
"UserGreeting", # Key symbol to check
|
||||||
),
|
),
|
||||||
"csharp": (
|
"csharp": (
|
||||||
"test.cs",
|
"test.cs",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue