forked from tempestphp/highlight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfileLanguageTest.php
More file actions
35 lines (29 loc) · 1.48 KB
/
DockerfileLanguageTest.php
File metadata and controls
35 lines (29 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
declare(strict_types=1);
namespace Languages\Dockerfile;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Tempest\Highlight\Highlighter;
class DockerfileLanguageTest extends TestCase
{
#[DataProvider('provide_highlight_cases')]
public function test_highlight(string $content, string $expected): void
{
$highlighter = new Highlighter();
$this->assertSame(
$expected,
$highlighter->parse($content, 'dockerfile'),
);
}
public static function provide_highlight_cases(): iterable
{
return [
['FROM python:3.13', '<span class="hl-keyword">FROM</span> <span class="hl-value">python</span>:<span class="hl-value">3.13</span>'],
['FROM php AS stage-one', '<span class="hl-keyword">FROM</span> <span class="hl-value">php</span> <span class="hl-keyword">AS</span> <span class="hl-value">stage-one</span>'],
['WORKDIR /usr/local/app', '<span class="hl-keyword">WORKDIR</span> /usr/local/app'],
['CMD ["node", "./src/index.js"]', '<span class="hl-keyword">CMD</span> [<span class="hl-value">"node"</span>, <span class="hl-value">"./src/index.js"</span>]'],
["CMD ['php', 'index.php']", '<span class="hl-keyword">CMD</span> [<span class="hl-value">\'php\'</span>, <span class="hl-value">\'index.php\'</span>]'],
['# This is a comment', '<span class="hl-comment"># This is a comment</span>'],
];
}
}