Merged revisions 551:552 from branches/Exiv2-0_6_041212. Fixes bug #423 in trunk
parent
58de1212d4
commit
6a0ecb420e
@ -0,0 +1,36 @@
|
|||||||
|
// ***************************************************************** -*- C++ -*-
|
||||||
|
// path-test.cpp, $Rev$
|
||||||
|
|
||||||
|
#include "utils.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
int main(int argc, char* const argv[])
|
||||||
|
{
|
||||||
|
if (argc != 2) {
|
||||||
|
std::cout << "Usage: " << argv[0] << " file\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
std::ifstream file(argv[1]);
|
||||||
|
if (!file) {
|
||||||
|
std::cerr << *argv[1] << ": Failed to open file for reading\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
std::string line;
|
||||||
|
while (std::getline(file, line)) {
|
||||||
|
std::string path, dir, base;
|
||||||
|
std::istringstream is(line);
|
||||||
|
is >> path >> dir >> base;
|
||||||
|
std::string d = Util::dirname(path);
|
||||||
|
std::string b = Util::basename(path);
|
||||||
|
|
||||||
|
if (d != dir || b != base) {
|
||||||
|
std::cout << path << "\t'" << d << "'\t '" << b
|
||||||
|
<< "'\t ==> Testcase failed\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
dir/base dir base
|
||||||
|
a/b/c a/b c
|
||||||
|
a/b/c/ a/b c
|
||||||
|
/ /
|
||||||
|
/a / a
|
||||||
|
foo . foo
|
||||||
|
bar/ . bar
|
||||||
|
bar\ . bar
|
||||||
|
dir\base dir base
|
||||||
|
a\b\c a\b c
|
||||||
|
a\b\c\ a\b c
|
||||||
|
c:\ c:
|
||||||
|
c:\bar c: bar
|
||||||
|
d:\foo\bar d:\foo bar
|
||||||
|
a . a
|
||||||
|
/////////// /
|
||||||
|
\\ \
|
||||||
|
\\srvfile00\foo\bar \\srvfile00\foo bar
|
||||||
|
\\srvfile01\foo \\srvfile01 foo
|
||||||
|
\\srvfile02 \\srvfile02
|
||||||
|
\\srvfile03\ \\srvfile03
|
||||||
|
//srvfile04 / srvfile04
|
||||||
|
//srvfile03/foo //srvfile03 foo
|
||||||
|
//srvfile02/foo/bar //srvfile02/foo bar
|
@ -0,0 +1,7 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Mini test-driver for path utility functions
|
||||||
|
LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH
|
||||||
|
binpath="../../src"
|
||||||
|
cd ./tmp
|
||||||
|
|
||||||
|
$binpath/path-test ../data/path-test.txt
|
Loading…
Reference in New Issue