| 745 | } |
| 746 | |
| 747 | void test_path_trunc() |
| 748 | { |
| 749 | QCOMPARE(FS::pathTruncate("", 0), QDir::toNativeSeparators("")); |
| 750 | QCOMPARE(FS::pathTruncate("foo.txt", 0), QDir::toNativeSeparators("")); |
| 751 | QCOMPARE(FS::pathTruncate("foo.txt", 1), QDir::toNativeSeparators("")); |
| 752 | QCOMPARE(FS::pathTruncate("./bar/foo.txt", 0), QDir::toNativeSeparators("./bar")); |
| 753 | QCOMPARE(FS::pathTruncate("./bar/foo.txt", 1), QDir::toNativeSeparators("./bar")); |
| 754 | QCOMPARE(FS::pathTruncate("/bar/foo.txt", 1), QDir::toNativeSeparators("/bar")); |
| 755 | QCOMPARE(FS::pathTruncate("bar/foo.txt", 1), QDir::toNativeSeparators("bar")); |
| 756 | QCOMPARE(FS::pathTruncate("baz/bar/foo.txt", 2), QDir::toNativeSeparators("baz/bar")); |
| 757 | #if defined(Q_OS_WIN) |
| 758 | QCOMPARE(FS::pathTruncate("C:\\bar\\foo.txt", 1), QDir::toNativeSeparators("C:\\bar")); |
| 759 | #endif |
| 760 | } |
| 761 | }; |
| 762 | |
| 763 | QTEST_GUILESS_MAIN(FileSystemTest) |
nothing calls this directly
no test coverage detected