Skip to content

Commit

Permalink
Move code.search tests under codemarkup/hack
Browse files Browse the repository at this point in the history
Summary: Looking at Hack now. Start by consolidating the search tests

Reviewed By: simonmar

Differential Revision: D66689693

fbshipit-source-id: 11cdda4d648fd7e700e7fa0416eab5f57dc405d6
  • Loading branch information
donsbot authored and facebook-github-bot committed Dec 4, 2024
1 parent 076d45a commit 29713b7
Show file tree
Hide file tree
Showing 98 changed files with 1,875 additions and 0 deletions.
7 changes: 7 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/.hhconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# some comment
assume_php = false

allowed_fixme_codes_strict = 4110
allowed_decl_fixme_codes = 4110

auto_namespace_map = {"Herp": "Derp\\Lib\\Herp"}
4 changes: 4 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/BaseModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

new module glean.test { }
26 changes: 26 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/RefClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

class RefClass implements SourceInterface {
use SourceTrait;

const int JAZZ = 39;

private int $raz = -50;

public static function foo(): int {
return corge() * WALDO;
}

public function bazza (): int {
return 5 * corge();
}

public function bar(SourceClass::T $param): int {
$source = new SourceClass();
$result1 = corge() + SourceClass::BAZ + $source->daz + $this::JAZZ + WALDO;
$result2 = $this->quux($result1) + Position::Right + $this::foo();
$result3 = $this->raz + $this->bazza() + SourceClass::superAdd(1, $param);
return ($result1 + $result2 + $result3 + Position::Center) * corge();
}
}
15 changes: 15 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/SourceClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

class SourceClass extends SuperClass {

const int BAZ = 2;

const type T = int;

public int $daz = 99;

public function bar(int $param): int {
return $param * corge();
}
}
10 changes: 10 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/SourceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

interface SourceInterface {

abstract const int JAZZ;

public static function foo(): int;

}
8 changes: 8 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/SourceTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

trait SourceTrait {
public function quux(int $i): int {
return $i * 2;
}
}
11 changes: 11 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/SuperClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

class SuperClass {

const int BAZ = 999;

public function superAdd(int $i, int $i): int {
return $i + $i + 55;
}
}
16 changes: 16 additions & 0 deletions glean/lang/codemarkup/tests/hack/search/TopLevel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

const int WALDO = -3;

function corge() : int {
return 5000 + WALDO;
}

enum Position: int as int {
Top = 0;
Bottom = 1;
Left = 2;
Right = 3;
Center = 4;
}
Loading

0 comments on commit 29713b7

Please sign in to comment.