blob: ed1792d74b15ecc7348c71fa6a4f73f3af8f35c9 [file] [log] [blame]
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "dart:io";
import "package:expect/expect.dart";
void main() async {
// Test that renaming a file doesn't change the modified time.
final temp = await Directory.systemTemp.createTemp('regress_36030');
final file = await File('${temp.path}/before').create();
final modifiedTime = await file.lastModified();
await Future.delayed(Duration(seconds: 1));
final renamed = await file.rename('${temp.path}/after');
final renamedTime = await renamed.lastModified();
Expect.equals(renamedTime, modifiedTime);
}