2015-11-02 09:50:40 +00:00
|
|
|
// 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 'dart:io';
|
|
|
|
|
2015-11-29 05:07:16 +00:00
|
|
|
import 'package:flutter_tools/src/base/os.dart';
|
2015-11-18 06:44:54 +00:00
|
|
|
import 'package:path/path.dart' as path;
|
2016-01-28 06:38:57 +00:00
|
|
|
import 'package:test/test.dart';
|
2015-11-02 09:50:40 +00:00
|
|
|
|
|
|
|
main() => defineTests();
|
|
|
|
|
|
|
|
defineTests() {
|
|
|
|
group('OperatingSystemUtils', () {
|
|
|
|
Directory temp;
|
|
|
|
|
|
|
|
setUp(() {
|
2015-11-10 21:18:34 +00:00
|
|
|
temp = Directory.systemTemp.createTempSync('flutter_tools');
|
2015-11-02 09:50:40 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
tearDown(() {
|
|
|
|
temp.deleteSync(recursive: true);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('makeExecutable', () {
|
2015-11-18 06:44:54 +00:00
|
|
|
File file = new File(path.join(temp.path, 'foo.script'));
|
2015-11-02 09:50:40 +00:00
|
|
|
file.writeAsStringSync('hello world');
|
2015-11-29 05:07:16 +00:00
|
|
|
os.makeExecutable(file);
|
2015-11-02 09:50:40 +00:00
|
|
|
|
|
|
|
// Skip this test on windows.
|
|
|
|
if (!Platform.isWindows) {
|
|
|
|
String mode = file.statSync().modeString();
|
|
|
|
// rwxr--r--
|
|
|
|
expect(mode.substring(0, 3), endsWith('x'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|