def test_glob_to_cmdrun_special_patterns(runtime_cls, run_as_openhands, temp_dir):
    """Test glob patterns with special characters."""
    runtime, config = _load_runtime(temp_dir, runtime_cls, run_as_openhands)
    try:
        # Create test files matching the patterns we'll test
        setup_cmd = r"""
        mkdir -p src/components src/utils && \
        touch src/file1.js src/file2.js src/file9.js && \
        touch src/components/comp.jsx src/components/comp.tsx && \
        touch src/$special-file.js && \
        touch src/temp1.js src/temp2.js && \
        touch src/file.js src/file.ts src/file.jsx && \
        touch "src/weird\`file\`.js" && \
        touch "src/file with spaces.js"
        """
        obs = _run_cmd_action(runtime, setup_cmd)
        assert obs.exit_code == 0, 'Failed to set up test files'

        special_patterns = [
            '**/*.js',  # Double glob
            '**/{*.jsx,*.tsx}',  # Braces
            'file[0-9].js',  # Character class
            'temp?.js',  # Single character wildcard
            'file.{js,ts,jsx}',  # Multiple extensions
            'file with spaces.js',  # Spaces
        ]

        for pattern in special_patterns:
            cmd = glob_to_cmdrun(pattern, 'src')
            logger.info(f'Command: {cmd}')
            # Execute the command
            obs = _run_cmd_action(runtime, cmd)
            assert obs.exit_code == 0, f'Glob command failed for pattern: {pattern}'

            # Verify expected files are found
            if pattern == '**/*.js':
                assert 'file1.js' in obs.content
                assert 'file2.js' in obs.content
            elif pattern == '**/{*.jsx,*.tsx}':
                assert 'comp.jsx' in obs.content
                assert 'comp.tsx' in obs.content
            elif pattern == 'file[0-9].js':
                assert 'file1.js' in obs.content
                assert 'file2.js' in obs.content
                assert 'file9.js' in obs.content
            elif pattern == 'temp?.js':
                assert 'temp1.js' in obs.content
                assert 'temp2.js' in obs.content
            elif pattern == 'file.{js,ts,jsx}':
                assert 'file.js' in obs.content
                assert 'file.ts' in obs.content
                assert 'file.jsx' in obs.content
            elif pattern == 'file with spaces.js':
                assert 'file with spaces.js' in obs.content
    finally:
        _close_test_runtime(runtime)
Test glob patterns with special characters.
tests/runtime/test_glob_and_grep.py