Skip to content

Commit 98365ba

Browse files
committed
add tests
1 parent e055e1c commit 98365ba

File tree

2 files changed

+120
-5
lines changed

2 files changed

+120
-5
lines changed

tests/php-ts-mode-resources/face.erts

+92
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,95 @@ class Ba|sic {}
4949
=-=
5050
php-class
5151
=-=-=
52+
53+
Name: Class base clause
54+
No-After-Newline: t
55+
56+
=-=
57+
<?php
58+
class Basic extends Par|ent{}
59+
=-=
60+
php-class
61+
=-=-=
62+
63+
Name: This sigil
64+
No-After-Newline: t
65+
66+
=-=
67+
<?php
68+
|$this
69+
=-=
70+
php-this-sigil
71+
=-=-=
72+
73+
Name: This
74+
No-After-Newline: t
75+
76+
=-=
77+
<?php
78+
$t|his
79+
=-=
80+
php-this
81+
=-=-=
82+
83+
Name: Optional type
84+
No-After-Newline: t
85+
86+
=-=
87+
<?php
88+
function test(|?int $arg) {}
89+
=-=
90+
php-type
91+
=-=-=
92+
93+
Name: Scoped propery access
94+
No-After-Newline: t
95+
96+
=-=
97+
<?php
98+
|Test::$test;
99+
=-=
100+
php-class
101+
=-=-=
102+
103+
Name: Class constant access with qualified name
104+
No-After-Newline: t
105+
106+
=-=
107+
<?php
108+
|\Test::TEST;
109+
=-=
110+
php-class
111+
=-=-=
112+
113+
Name: Trait use declation
114+
No-After-Newline: t
115+
116+
=-=
117+
<?php
118+
class Test {
119+
use Te|st;
120+
}
121+
=-=
122+
php-class
123+
=-=-=
124+
125+
Name: Built-in function
126+
No-After-Newline: t
127+
128+
=-=
129+
<?php
130+
iss|et($t)
131+
=-=
132+
php-keyword
133+
=-=-=
134+
135+
Name: Object create expression with qualified name
136+
No-After-Newline: t
137+
138+
=-=
139+
<?php
140+
$t = new |\Test();
141+
=-=
142+
php-class
143+
=-=-=

tests/php-ts-mode-resources/indent.erts

+28-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Code:
22
(lambda ()
33
(setq indent-tabs-mode nil)
44
(setq php-ts-mode-indent-offset 4)
5+
(setq tab-width 4)
56
(php-ts-mode)
67
(indent-region (point-min) (point-max)))
78

@@ -97,6 +98,16 @@ Name: Opening bracket on new line
9798
=-=
9899
<?php
99100

101+
class Test
102+
{
103+
public function test(): void
104+
{
105+
return;
106+
}
107+
}
108+
=-=
109+
<?php
110+
100111
class Test
101112
{
102113
public function test(): void
@@ -106,18 +117,30 @@ class Test
106117
}
107118
=-=-=
108119

109-
Name: Switch
120+
Name: Switch default statement
110121

111122
=-=
112123
<?php
113124

114-
public function test()
125+
function test()
126+
{
127+
switch ($cond) {
128+
case 1:
129+
return 1;
130+
default:
131+
return 2;
132+
}
133+
}
134+
=-=
135+
<?php
136+
137+
function test()
115138
{
116139
switch ($cond) {
117140
case 1:
118-
return 1;
119-
default:
120-
return 2;
141+
return 1;
142+
default:
143+
return 2;
121144
}
122145
}
123146
=-=-=

0 commit comments

Comments
 (0)