summaryrefslogtreecommitdiffstats
path: root/tests/Lexer/ContextTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Lexer/ContextTest.php')
-rw-r--r--tests/Lexer/ContextTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php
index b630d03..50e500a 100644
--- a/tests/Lexer/ContextTest.php
+++ b/tests/Lexer/ContextTest.php
@@ -36,4 +36,29 @@ class ContextTest extends TestCase
{
Context::load('Foo');
}
+
+ public function testMode()
+ {
+ Context::setMode('REAL_AS_FLOAT,ANSI_QUOTES,IGNORE_SPACE');
+ $this->assertEquals(
+ Context::REAL_AS_FLOAT | Context::ANSI_QUOTES | Context::IGNORE_SPACE,
+ Context::$MODE
+ );
+ Context::setMode();
+ $this->assertEquals(0, Context::$MODE);
+ }
+
+ public function testEscape()
+ {
+ Context::setMode('ANSI_QUOTES');
+ $this->assertEquals('"test"', Context::escape('test'));
+
+ Context::setMode();
+ $this->assertEquals('`test`', Context::escape('test'));
+
+ $this->assertEquals(
+ array('`a`', '`b`'),
+ Context::escape(array('a', 'b'))
+ );
+ }
}