Skip to content

Commit 1dbc0d0

Browse files
committed
Added a test for html encoded input to the compiler
1 parent 2fa9595 commit 1dbc0d0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Symfony/src/Codebender/CompilerBundle/Tests/Controller/DefaultControllerFunctionalTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,27 @@ public function testEthernetCompileErrorRemovedPersonalLibraryPaths()
295295
$this->assertContains('(personal library file) PseudoEthernet/Ethernet.h:1:10: </b><b><font style="color: red">fatal error: </font></b><b>\'SPI.h\' file not found', $response['message']);
296296
}
297297

298+
public function testHtmlEncodedInput()
299+
{
300+
$files = array(array("filename" => "Blink.ino", "content" => htmlspecialchars("#include <Ethernet.h>\nint * pointer;\nvoid setup() {\nint ** var = &pointer;\n}\nvoid loop() {\n}\n")));
301+
$format = "binary";
302+
$version = "105";
303+
$libraries = array('Ethernet' => array('files' => array('filename' => 'Ethernet.h', 'content' => htmlspecialchars("\n"))));
304+
$build = array("mcu" => "atmega328p", "f_cpu" => "16000000", "core" => "arduino", "variant" => "standard");
305+
306+
$data = json_encode(array("files" => $files, "format" => $format, "version" => $version, "libraries" => $libraries, "build" => $build));
307+
308+
$client = static::createClient();
309+
310+
$authorizationKey = $client->getContainer()->getParameter("authorizationKey");
311+
312+
$client->request('POST', '/' . $authorizationKey . '/v1', array(), array(), array(), $data);
313+
314+
$response = json_decode($client->getResponse()->getContent(), true);
315+
316+
$this->assertTrue($response["success"]);
317+
}
318+
298319
public function testAutocomplete()
299320
{
300321
$this->markTestIncomplete('No tests for the code completion feature yet.');

0 commit comments

Comments
 (0)