Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
urbit-pilled committed Mar 28, 2024
1 parent fc90e44 commit cbf8081
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion crates/core/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12823,7 +12823,7 @@ fn php_simple_match() {
pattern: r#"
|language php
|
|`echo ^match;` => `^match + ^match;`
|`echo ^x;` => `^x + ^x;`
|"#
.trim_margin()
.unwrap(),
Expand Down Expand Up @@ -12945,6 +12945,72 @@ fn php_delete_include() {
.unwrap();
}

#[test]
fn php_function_modifier() {
run_test_expected(
TestArgExpected {
pattern: r#"
|language php
|
|`class ^_ { ^mod function ^name(){ ^_ } }` where {
| ^mod => `private`,
| ^name => `modified`,
|}
|"#
.trim_margin()
.unwrap(),
source: r#"
|class Log {
| public function printHello()
| {
| echo $this->public;
| echo $this->protected;
| echo $this->private;
| }
|}
|"#
.trim_margin().
unwrap(),
expected: r#"
|class Log {
| private function modified()
| {
| echo $this->public;
| echo $this->protected;
| echo $this->private;
| }
|}
|"#
.trim_margin()
.unwrap(),
}
)
.unwrap();
}

#[test]
fn php_rewrite_arrow_function() {
run_test_expected(
TestArgExpected {
pattern: r#"
|language php
|
|`fn(^a) => ^_` => `fn(^a) => $x * $x`
|"#
.trim_margin()
.unwrap(),
source: "$fn1 = fn($x) => $x + $y;"
.trim_margin().
unwrap(),
expected: "$fn1 = fn($x) => $x * $x;"
.trim_margin()
.unwrap(),
}
)
.unwrap();
}


#[test]
fn css_property_value() {
run_test_match(TestArg {
Expand Down

0 comments on commit cbf8081

Please sign in to comment.