-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
money where the mouth is, make damn sure it works.
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Tests\Feature; | ||
|
||
use PGEtinker\Compiler; | ||
use Tests\TestCase; | ||
|
||
class ProcessCodeTest extends TestCase | ||
{ | ||
|
||
public function test_passthru_non_macros(): void | ||
{ | ||
$compiler = new Compiler(); | ||
|
||
$code = "I can write anything wheeeee!#define OLC_PGE_APPLICATION\n"; | ||
$compiler->setCode($code); | ||
$compiler->processCode(); | ||
$this->assertTrue($code == $compiler->getCode()); | ||
|
||
$code = "#define OLC_PGE_APPLICATIONYEAAAAAAA\n"; | ||
$compiler->setCode($code); | ||
$compiler->processCode(); | ||
$this->assertTrue($code == $compiler->getCode()); | ||
|
||
$code = "I can write anything wheeeee!#define OLC_PGE_APPLICATIONYEAAAAAAA\n"; | ||
$compiler->setCode($code); | ||
$compiler->processCode(); | ||
$this->assertTrue($code == $compiler->getCode()); | ||
} | ||
|
||
public function test_valid_white_space_macros(): void | ||
{ | ||
$compiler = new Compiler(); | ||
|
||
$code = "\t #define OLC_PGE_APPLICATION\n"; | ||
$compiler->setCode($code); | ||
$compiler->processCode(); | ||
print_r($code); | ||
print_r($compiler->getCode()); | ||
$this->assertTrue($code != $compiler->getCode()); | ||
|
||
$code = "# define OLC_PGE_APPLICATION\n"; | ||
$compiler->setCode($code); | ||
$compiler->processCode(); | ||
$this->assertTrue($code != $compiler->getCode()); | ||
|
||
$code = "#define OLC_PGE_APPLICATION\n"; | ||
$compiler->setCode($code); | ||
$compiler->processCode(); | ||
$this->assertTrue($code != $compiler->getCode()); | ||
|
||
$code = "#define OLC_PGE_APPLICATION \n"; | ||
$compiler->setCode($code); | ||
$compiler->processCode(); | ||
$this->assertTrue($code != $compiler->getCode()); | ||
} | ||
|
||
// public function test_process_code_fails_on_bad_macro(): void | ||
// { | ||
// $compiler = new Compiler(); | ||
|
||
// $code = "I can write anything wheeeee!#define OLC_PGE_APPLICATIONYEAAAAAAA\n"; | ||
// $compiler->setCode($code); | ||
// $compiler->processCode(); | ||
|
||
// $this->assertTrue($code == $compiler->getCode()); | ||
// } | ||
|
||
} |