File:  [parser3project] / parser3 / tests / 157.html
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Thu May 10 23:06:11 2018 UTC (8 years ago) by moko
Branches: MAIN
CVS tags: release_3_5_1, release_3_5_0, release_3_4_6, HEAD
test for ^file:copy[..; $.append(bool) ] option added (related to feature #919)

$sSrc[157.html]

$stSrc[^file::stat[$sSrc]]

$sCopy[newdir1/157.copy]
$sMove[newdir2/157.move]
^try-catch{
	Copying file: ^file:copy[$sSrc;$sCopy]
	^if(-f $sCopy){
		ok.
	}{
		no copy errors but target file doesn't exist.
	}
}
<br />

^if(! -f $sCopy){
	^return[]
}

^try-catch{
	Appending file: ^file:copy[$sSrc;$sCopy; $.append(true) ]

	$stCopy[^file::stat[$sCopy]]
	^if($stCopy.size == $stSrc.size*2){
		ok.
	}{
		appended file size $stCopy.size is not double of source file size ${stSrc.size}.
	}
}
<br />

^try-catch{
	Moving file: ^file:move[$sCopy;$sMove]
	^if(-f $sMove){
		^if(-d ^file:dirname[$sCopy]){
			moving ok but source dir still exist.
		}{
			ok.
		}
		^file:delete[$sMove]
	}{
		no move errors but target file doesn't exist.
	}
}

E-mail: