import 'package:flutter_test/flutter_test.dart'; import 'package:openchamber/api/models.dart'; void main() { test('a Windows project path reads as its folder name', () { expect(pathLeaf(r'C:\msys64\home\Gary\Sources\pineapple-notepad'), 'pineapple-notepad'); expect(pathLeaf('/home/blumia/Sources/telegram/'), 'telegram'); expect(pathLeaf('relative'), 'relative'); expect( ProjectInfo(id: 'p', canonical: r'C:\work\pineapple-notepad').label, 'pineapple-notepad', ); expect( ProjectInfo(id: 'p', canonical: '/w/x', name: '显式名称').label, '显式名称', ); }); test('the same place compares across separators and Windows case', () { expect(samePath(r'C:\x\y', 'C:/x/y'), isTrue); expect(samePath(r'C:\X\y', r'c:\x\Y'), isTrue); expect(samePath('/a/b/', '/a/b'), isTrue); expect(samePath('/a/b', '/a/c'), isFalse); // A POSIX path stays case-sensitive. expect(samePath('/a/B', '/a/b'), isFalse); }); test('slashPath only unifies separators', () { expect(slashPath(r'C:\a\b\'), 'C:/a/b'); }); }