flutter/packages/flutter_tools/test/os_utils_test.dart
Todd Volkert 016b5ab0cc Force all dart:io usage to go through 'base/io.dart' (#7390)
This ensures that accidental usages of dart:io's
file API don't creep in over time.
2017-01-09 08:37:00 -08:00

41 lines
1.1 KiB
Dart

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/os.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
import 'src/context.dart';
void main() {
group('OperatingSystemUtils', () {
Directory temp;
setUp(() {
temp = fs.systemTempDirectory.createTempSync('flutter_tools');
});
tearDown(() {
temp.deleteSync(recursive: true);
});
testUsingContext('makeExecutable', () async {
File file = fs.file(path.join(temp.path, 'foo.script'));
file.writeAsStringSync('hello world');
os.makeExecutable(file);
// Skip this test on windows.
if (!Platform.isWindows) {
String mode = file.statSync().modeString();
// rwxr--r--
expect(mode.substring(0, 3), endsWith('x'));
}
}, overrides: <Type, Generator> {
OperatingSystemUtils: () => new OperatingSystemUtils(),
});
});
}