|
@@ -101,7 +101,7 @@ public class TestFsShellTouch {
|
|
|
{
|
|
|
assertThat(
|
|
|
"Expected successful touch on a non-existent file with -c option",
|
|
|
- shellRun("-touch", "-c", newFileName), is(not(0)));
|
|
|
+ shellRun("-touch", "-c", newFileName), is(0));
|
|
|
assertThat(lfs.exists(newFile), is(false));
|
|
|
}
|
|
|
|
|
@@ -140,7 +140,7 @@ public class TestFsShellTouch {
|
|
|
Date dateObj = parseTimestamp(strTime);
|
|
|
|
|
|
assertThat(
|
|
|
- "Expected successful touch with a specified modificatiom time",
|
|
|
+ "Expected successful touch with a specified modification time",
|
|
|
shellRun("-touch", "-m", "-t", strTime, newFileName), is(0));
|
|
|
// Verify if modification time is recorded correctly (and access time
|
|
|
// remains unchanged).
|
|
@@ -179,6 +179,16 @@ public class TestFsShellTouch {
|
|
|
assertThat("Expected failed touch with a missing timestamp",
|
|
|
shellRun("-touch", "-t", newFileName), is(not(0)));
|
|
|
}
|
|
|
+
|
|
|
+ // Verify -c option when file exists.
|
|
|
+ String strTime = formatTimestamp(System.currentTimeMillis());
|
|
|
+ Date dateObj = parseTimestamp(strTime);
|
|
|
+ assertThat(
|
|
|
+ "Expected successful touch on a non-existent file with -c option",
|
|
|
+ shellRun("-touch", "-c", "-t", strTime, newFileName), is(0));
|
|
|
+ FileStatus fileStatus = lfs.getFileStatus(newFile);
|
|
|
+ assertThat(fileStatus.getAccessTime(), is(dateObj.getTime()));
|
|
|
+ assertThat(fileStatus.getModificationTime(), is(dateObj.getTime()));
|
|
|
}
|
|
|
|
|
|
private String formatTimestamp(long timeInMillis) {
|