Skip to content

Commit

Permalink
support and require fbexpect 2.7.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
jjergus committed Oct 24, 2019
1 parent 11d4f64 commit 0276f49
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
],
"type": "library",
"require-dev": {
"hhvm/fbexpect": "^2.7.0",
"hhvm/hacktest": "^1.0",
"hhvm/type-assert": "^3.1",
"facebook/fbexpect": "^2.1.0",
Expand Down
14 changes: 7 additions & 7 deletions tests/CodegenClassTest.hack
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ final class CodegenClassTest extends CodegenBaseTest {
$cgf = $this->getCodegenFactory();
$code = $cgf->codegenClass('Foo')->setExtendsf('X<%s>', 'Y')->render();

expect($code)->toContain('extends X<Y>');
expect($code)->toContainSubstring('extends X<Y>');
}

public function testGenericsWithSubtypeConstraints(): void {
Expand All @@ -266,7 +266,7 @@ final class CodegenClassTest extends CodegenBaseTest {
->addGenericSubtypeConstraint('T', 'U')
->render();

expect($code)->toContain('T as U');
expect($code)->toContainSubstring('T as U');
}

public function testGenericsWithSuperTypeConstraints(): void {
Expand All @@ -275,7 +275,7 @@ final class CodegenClassTest extends CodegenBaseTest {
->addGenericSupertypeConstraint('T', 'U')
->render();

expect($code)->toContain('T super U');
expect($code)->toContainSubstring('T super U');
}

public function testGenericsWithConstraints(): void {
Expand All @@ -288,9 +288,9 @@ final class CodegenClassTest extends CodegenBaseTest {
->addGeneric('Tsingle')
->render();

expect($code)->toContain('Tk as Tv');
expect($code)->toContain('Tu super Sp');
expect($code)->toContain('Tt as Xx');
expect($code)->toContain('Tsingle');
expect($code)->toContainSubstring('Tk as Tv');
expect($code)->toContainSubstring('Tu super Sp');
expect($code)->toContainSubstring('Tt as Xx');
expect($code)->toContainSubstring('Tsingle');
}
}
6 changes: 3 additions & 3 deletions tests/CodegenFileTest.hack
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ final class CodegenFileTest extends CodegenBaseTest {
->setFileType(CodegenFileType::HACK_STRICT)
->setShebangLine('#!/usr/bin/env hhvm')
->render(),
)->toThrow(\HH\InvariantException::class);
)->toThrow(InvariantException::class);
}

public function testDotHackExecutable(): void {
Expand All @@ -341,7 +341,7 @@ final class CodegenFileTest extends CodegenBaseTest {
->setFileType(CodegenFileType::HACK_STRICT)
->setPseudoMainHeader('exit();')
->render(),
)->toThrow(\HH\InvariantException::class);
)->toThrow(InvariantException::class);
}

public function testNoPseudoMainFooterInStrict(): void {
Expand All @@ -351,7 +351,7 @@ final class CodegenFileTest extends CodegenBaseTest {
->setFileType(CodegenFileType::HACK_STRICT)
->setPseudoMainFooter('exit();')
->render(),
)->toThrow(\HH\InvariantException::class);
)->toThrow(InvariantException::class);
}

public function testFormattingFullyGeneratedFile(): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/HackBuilderTest.hack
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ $del."extends SomeBaseClass",
HackBuilderValues::vector(HackBuilderValues::export()),
)
->getCode();
expect($body)->toContain('Vector');
expect($body)->toNotContain('HH');
expect($body)->toContainSubstring('Vector');
expect($body)->toNotContainSubstring('HH');
expect_with_context(static::class, $body)->toBeUnchanged();
}

Expand Down

0 comments on commit 0276f49

Please sign in to comment.