import { parseTextWithBrackets } from './textParser'

// 测试解析功能
const testCases = [
  {
    input: '这是一段普通文本(英文括号)',
    expected: [
      { text: '这是一段普通文本', isInBrackets: false },
      { text: '(英文括号)', isInBrackets: true },
    ],
  },
  {
    input: '这是一段普通文本（中文括号）',
    expected: [
      { text: '这是一段普通文本', isInBrackets: false },
      { text: '（中文括号）', isInBrackets: true },
    ],
  },
  {
    input: '开始（中文）中间(英文)结束',
    expected: [
      { text: '开始', isInBrackets: false },
      { text: '（中文）', isInBrackets: true },
      { text: '中间', isInBrackets: false },
      { text: '(英文)', isInBrackets: true },
      { text: '结束', isInBrackets: false },
    ],
  },
  {
    input: '没有括号的文本',
    expected: [{ text: '没有括号的文本', isInBrackets: false }],
  },
  {
    input: '(全部都是括号)',
    expected: [{ text: '(全部都是括号)', isInBrackets: true }],
  },
]

console.log('测试文本解析功能:')
testCases.forEach((testCase, index) => {
  const result = parseTextWithBrackets(testCase.input)
  console.log(`\n测试 ${index + 1}: ${testCase.input}`)
  console.log('期望结果:', testCase.expected)
  console.log('实际结果:', result)
  console.log('测试通过:', JSON.stringify(result) === JSON.stringify(testCase.expected))
})
