Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix typo in comment and add more tests of file name transformation methods. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | mvRmHardFix |
| Files: | files | file ages | folders |
| SHA1: |
9b41960e82af52614d966002373a217e |
| User & Date: | mistachkin 2015-05-26 22:39:18.350 |
Context
|
2015-05-26
| ||
| 23:28 | Enhance error handling when there is no open checkout and add comments. check-in: d12fc4b148 user: mistachkin tags: mvRmHardFix | |
| 22:39 | Fix typo in comment and add more tests of file name transformation methods. check-in: 9b41960e82 user: mistachkin tags: mvRmHardFix | |
| 21:46 | Enhance file_tree_name() to be capable of producing absolute paths within the local tree. Fix --hard option to mv/rm to enable it to work properly with relative paths. check-in: c2df31dae8 user: mistachkin tags: mvRmHardFix | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
1110 1111 1112 1113 1114 1115 1116 | /* ** COMMAND: test-tree-name ** ** Test the operation of the tree name generator. ** ** Options: | | | 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 |
/*
** COMMAND: test-tree-name
**
** Test the operation of the tree name generator.
**
** Options:
** --absolute Return an absolute path instead of a relative one.
** --case-sensitive B Enable or disable case-sensitive filenames. B is
** a boolean: "yes", "no", "true", "false", etc.
*/
void cmd_test_tree_name(void){
int i;
Blob x;
int absoluteFlag = find_option("absolute",0,0)!=0;
|
| ︙ | ︙ |
Changes to test/file1.test.
| ︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
set i 1
foreach {subdir path result} $args {
fossil test-relative-name --chdir $subdir $path
test relative-name-$testname.$i {$::RESULT==$result}
incr i
}
}
simplify-name 100 . . .// . .. .. ..///// ..
simplify-name 101 {} {} / / ///////// / ././././ .
simplify-name 102 x x /x /x ///x //x
simplify-name 103 a/b a/b /a/b /a/b a///b a/b ///a///b///// //a/b
simplify-name 104 a/b/../c/ a/c /a/b/../c /a/c /a/b//../c /a/c /a/b/..///c /a/c
simplify-name 105 a/b/../../x/y x/y /a/b/../../x/y /x/y
| > > > > > > > > > > > > > > > > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
set i 1
foreach {subdir path result} $args {
fossil test-relative-name --chdir $subdir $path
test relative-name-$testname.$i {$::RESULT==$result}
incr i
}
}
proc relative-tree-name {testname args} {
set i 1
foreach {subdir path result} $args {
fossil test-tree-name --chdir $subdir $path
test relative-tree-name-$testname.$i {$::RESULT==$result}
incr i
}
}
proc absolute-tree-name {testname args} {
set i 1
foreach {subdir path result} $args {
fossil test-tree-name --chdir $subdir --absolute $path
test absolute-tree-name-$testname.$i {$::RESULT==$result}
incr i
}
}
simplify-name 100 . . .// . .. .. ..///// ..
simplify-name 101 {} {} / / ///////// / ././././ .
simplify-name 102 x x /x /x ///x //x
simplify-name 103 a/b a/b /a/b /a/b a///b a/b ///a///b///// //a/b
simplify-name 104 a/b/../c/ a/c /a/b/../c /a/c /a/b//../c /a/c /a/b/..///c /a/c
simplify-name 105 a/b/../../x/y x/y /a/b/../../x/y /x/y
|
| ︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 |
# Those directories are only needed for the testcase being able to "--chdir" to it.
file mkdir test1
file mkdir test1/test2
relative-name 100 . . . test1 [pwd] .. test1 [pwd]/ .. test1 [pwd]/test ../test
relative-name 101 test1/test2 [pwd] ../.. test1/test2 [pwd]/ ../.. test1/test2 [pwd]/test ../../test
relative-name 102 test1 [pwd]/test ../test . [pwd]/file1 ./file1 . [pwd]/file1/file2 ./file1/file2
catch {file delete test1/test2}
catch {file delete test1}
| > > > > > > > > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# Those directories are only needed for the testcase being able to "--chdir" to it.
file mkdir test1
file mkdir test1/test2
relative-name 100 . . . test1 [pwd] .. test1 [pwd]/ .. test1 [pwd]/test ../test
relative-name 101 test1/test2 [pwd] ../.. test1/test2 [pwd]/ ../.. test1/test2 [pwd]/test ../../test
relative-name 102 test1 [pwd]/test ../test . [pwd]/file1 ./file1 . [pwd]/file1/file2 ./file1/file2
relative-name 103 . [pwd] .
relative-tree-name 100 . . file1 test1 [pwd] file1 test1 [pwd]/ file1 test1 [pwd]/test file1/test
relative-tree-name 101 test1/test2 [pwd] file1 test1/test2 [pwd]/ file1 test1/test2 [pwd]/test file1/test
relative-tree-name 102 test1 [pwd]/test file1/test . [pwd]/file1 file1/file1 . [pwd]/file1/file2 file1/file1/file2
relative-tree-name 103 . [pwd] file1
set dirname [file normalize [file dirname [pwd]]]
absolute-tree-name 100 . . $dirname test1 [pwd] [pwd] test1 [pwd]/ $dirname/file1 test1 [pwd]/test $dirname/file1/test
absolute-tree-name 101 test1/test2 [pwd] $dirname/file1 test1/test2 [pwd]/ $dirname/file1 test1/test2 [pwd]/test $dirname/file1/test
absolute-tree-name 102 test1 [pwd]/test $dirname/file1/test . [pwd]/file1 $dirname/file1/file1 . [pwd]/file1/file2 $dirname/file1/file1/file2
absolute-tree-name 103 . [pwd] $dirname/file1
catch {file delete test1/test2}
catch {file delete test1}
|