Browse Source

Removed obvious typings

tags/v1.0.0
Cédric Belin 4 months ago
parent
commit
a95a792c3f
9 changed files with 17 additions and 23 deletions
  1. +0
    -0
      build_php.hxml
  2. +1
    -1
      src/which/Finder.hx
  3. +1
    -1
      src/which/FinderException.hx
  4. +5
    -5
      src/which/Program.hx
  5. +3
    -3
      test/TestAll.hx
  6. +2
    -2
      test/which/FinderTest.hx
  7. +2
    -2
      test/which/ProcessTest.hx
  8. +3
    -3
      test/which/ToolsTest.hx
  9. +0
    -6
      tool/run.ps1

+ 0
- 0
build_php.hxml View File

@@ -1,4 +1,3 @@
--define php-lib=php
--define real-position
--main which.Program


+ 1
- 1
src/which/Finder.hx View File

@@ -53,7 +53,7 @@ import php.NativeStructArray;
}

/** Gets a value indicating whether the current platform is Windows. **/
static function get_isWindows(): Bool {
static function get_isWindows() {
if (Sys.systemName() == "Windows") return true;
final osType = Sys.getEnv("OSTYPE");
return osType == "cygwin" || osType == "msys";


+ 1
- 1
src/which/FinderException.hx View File

@@ -12,7 +12,7 @@ import haxe.Exception;
public final finder: Finder;

/** Creates a new finder exception. **/
public function new(command: String, finder: Finder, message: String = "", ?previous: Exception) {
public function new(command: String, finder: Finder, message = "", ?previous: Exception) {
super(message, previous);
this.command = command;
this.finder = finder;


+ 5
- 5
src/which/Program.hx View File

@@ -11,22 +11,22 @@ using which.Tools;
class Program {

/** List all instances of executables found (instead of just the first one). **/
public var all: Bool = false;
public var all = false;

/** Output usage information. **/
public var help: Bool = false;
public var help = false;

/** Silence the output, just return the exit code (0 if any executable is found, otherwise 1). **/
public var silent: Bool = false;
public var silent = false;

/** Output the version number. **/
public var version: Bool = false;
public var version = false;

/** Creates a new program. **/
public function new() {}

/** Application entry point. **/
static function main(): Void
static function main()
Cli.process(Sys.args(), new Program()).handle(Cli.exit);

/** <command> : The name of the command to find. **/


+ 3
- 3
test/TestAll.hx View File

@@ -10,12 +10,12 @@ class TestAll {
/** The test cases. **/
static final tests = [
new FinderTest(),
new MainTest(),
new ProcessTest()
new ProcessTest(),
new ToolsTest()
];

/** Application entry point. **/
static function main(): Void {
static function main() {
final runner = new Runner();
runner.onComplete.add(_ -> {
final logger = MCoverage.getLogger();


+ 2
- 2
test/which/FinderTest.hx View File

@@ -9,7 +9,7 @@ class FinderTest extends Test {
static final isWindows = Sys.systemName() == "Windows";

/** Tests the `find()` method. **/
function testFind(async: Async): Void {
function testFind(async: Async) {
final finder = new Finder({path: ["test/fixtures"]});

// It should return the path of the `executable.cmd` file on Windows.
@@ -28,7 +28,7 @@ class FinderTest extends Test {
}

/** Tests the `isExecutable()` method. **/
function testIsExecutable(async: Async): Void {
function testIsExecutable(async: Async) {
final finder = new Finder();

// It should return `false` for a non-existent file.


+ 2
- 2
test/which/ProcessTest.hx View File

@@ -4,7 +4,7 @@ package which;
class ProcessTest extends Test {

/** Tests the `gid` property. **/
function testGid(async: Async): Void {
function testGid(async: Async) {
// It should be `-1` on Windows, otherwise greater than or equal to zero.
Process.gid.then(gid -> {
Assert.isTrue(Sys.systemName() == "Windows" ? gid == -1 : gid >= 0);
@@ -13,7 +13,7 @@ class ProcessTest extends Test {
}

/** Tests the `uid` property. **/
function testUid(async: Async): Void {
function testUid(async: Async) {
// It should be `-1` on Windows, otherwise greater than or equal to zero.
Process.uid.then(uid -> {
Assert.isTrue(Sys.systemName() == "Windows" ? uid == -1 : uid >= 0);


test/which/MainTest.hx → test/which/ToolsTest.hx View File

@@ -3,14 +3,14 @@ package which;
using StringTools;
using thenshim.PromiseTools;

/** Tests the features of the `Main` class. **/
class MainTest extends Test {
/** Tests the features of the `Tools` class. **/
class ToolsTest extends Test {

/** Value indicating whether the current platform is Windows. **/
static final isWindows = Sys.systemName() == "Windows";

/** Tests the `which()` method. **/
function testWhich(async: Async): Void {
function testWhich(async: Async) {
// It should return the path of the `executable.cmd` file on Windows.
async.branch(branch -> Main.which("executable", {all: false, path: ["test/fixtures"]})
.then(executable -> isWindows ? Assert.isTrue(executable.endsWith("\\test\\fixtures\\executable.cmd")) : Assert.fail("Exception not thrown"))

+ 0
- 6
tool/run.ps1 View File

@@ -1,6 +0,0 @@
#!/usr/bin/env pwsh
Set-StrictMode -Version Latest
Set-Location (Split-Path $PSScriptRoot)

haxe build_neko.hxml
neko run.n $args

Loading…
Cancel
Save