// Copyright (c) 2017, 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.

@TestOn('vm')
library;

import 'package:io/io.dart';
import 'package:test/test.dart';

void main() {
  group('isExecutable', () {
    const files = 'test/_files';
    const shellIsExec = '$files/is_executable.sh';
    const shellNotExec = '$files/is_not_executable.sh';

    group('on shell scripts', () {
      test('should return true for "is_executable.sh"', () async {
        expect(await isExecutable(shellIsExec), isTrue);
      });

      test('should return false for "is_not_executable.sh"', () async {
        expect(await isExecutable(shellNotExec), isFalse);
      });
    }, testOn: '!windows');

    group('on shell scripts [windows]', () {
      test('should return true for "is_executable.sh"', () async {
        expect(await isExecutable(shellIsExec, isWindows: true), isTrue);
      });

      test('should return true for "is_not_executable.sh"', () async {
        expect(await isExecutable(shellNotExec, isWindows: true), isTrue);
      });
    });
  });
}
