-
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.
Merge pull request #79 from Moros1138/78-define-olc_pge_application-l…
…ine-can-have-miscellaneous-text-surrounding-it-no-side-effects-bug-in-version-aee3eb2 78 define olc pge application line can have miscellaneous text surrounding it no side effects bug in version aee3eb2
- Loading branch information
Showing
3 changed files
with
116 additions
and
25 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
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
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()); | ||
// } | ||
|
||
} |