From f6b89f11573b07fb7fb4dee677460dbfa8ffc37c Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Mon, 6 Jun 2022 18:59:09 +0000 Subject: [PATCH 1/2] Add devcontainer --- .devcontainer/devcontainer.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..cf52b88 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +// For format details, see https://aka.ms/devcontainer.json. +{ + "name": "Hack", + "runArgs": [ + "--init" + ], + "image": "hhvm/hhvm:latest", + + // Set *default* container specific settings.json values on container create. + "userEnvProbe": "loginShell", + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "pranayagarwal.vscode-hack" + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && composer install" + +} From 3f24f4afd170e0e2a7b1844a1806a987b1f76a01 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Mon, 6 Jun 2022 19:02:15 +0000 Subject: [PATCH 2/2] Fix lint errors --- src/Constraint/IsType.hack | 2 +- src/Constraint/TraversableContains.hack | 2 +- src/ExpectObj.hack | 2 +- tests/ExpectObjTest.hack | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Constraint/IsType.hack b/src/Constraint/IsType.hack index df4f2a8..b62d8d8 100644 --- a/src/Constraint/IsType.hack +++ b/src/Constraint/IsType.hack @@ -11,7 +11,7 @@ namespace Facebook\FBExpect\Constraint; use function Facebook\FBExpect\is_iterable; -class IsType { +final class IsType { const type TPredicate = (function(mixed): bool); public function __construct(private string $expectedType) {} diff --git a/src/Constraint/TraversableContains.hack b/src/Constraint/TraversableContains.hack index 12c1c6f..1dfbf8c 100644 --- a/src/Constraint/TraversableContains.hack +++ b/src/Constraint/TraversableContains.hack @@ -9,7 +9,7 @@ namespace Facebook\FBExpect\Constraint; -class TraversableContains { +final class TraversableContains { public function __construct(private mixed $value) {} diff --git a/src/ExpectObj.hack b/src/ExpectObj.hack index 14ff328..d53118a 100644 --- a/src/ExpectObj.hack +++ b/src/ExpectObj.hack @@ -14,7 +14,7 @@ use namespace HH\Lib\{C, Str, Vec}; use type HH\Lib\Ref; use type Facebook\HackTest\ExpectationFailedException; -class ExpectObj extends Assert { +final class ExpectObj extends Assert { public function __construct(private T $var) {} /************************************** diff --git a/tests/ExpectObjTest.hack b/tests/ExpectObjTest.hack index 65e17e6..9fbc87f 100644 --- a/tests/ExpectObjTest.hack +++ b/tests/ExpectObjTest.hack @@ -100,7 +100,7 @@ final class ExpectObjTest extends HackTest { expect('haystack')->toNotMatchRegExp('/needle/'); // sorting - expect(vec[1, 2, 3])->toBeSortedBy(function(int $prev, int $curr): bool { + expect(vec[1, 2, 3])->toBeSortedBy((int $prev, int $curr): bool ==> { if ($prev <= $curr) { return true; } @@ -218,7 +218,6 @@ final class ExpectObjTest extends HackTest { } else { expect(() ==> $rm->invokeArgs($obj, vec[$expected, 'custom msg'])) ->toThrow(ExpectationFailedException::class, 'custom msg'); - ; } // And with funky sprintfification @@ -248,7 +247,7 @@ final class ExpectObjTest extends HackTest { // public function testToThrowWithMessage(): void { expect( - function() { + () ==> { expect( () ==> { throw new ExpectObjTestException('test 2');