Skip to content

Commit 07552af

Browse files
committed
fix(embed): change sapi tests to outer macro pattern
Refs: #335
1 parent 11e0d20 commit 07552af

File tree

2 files changed

+21
-25
lines changed

2 files changed

+21
-25
lines changed

tests/module.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,15 @@ fn test_module() {
2626
});
2727
}
2828

29-
/// Gives you a nice greeting!
30-
///
31-
/// @param string $name Your name.
32-
///
33-
/// @return string Nice greeting!
34-
#[php_function]
35-
pub fn hello_world(name: String) -> String {
36-
format!("Hello, {}!", name)
37-
}
38-
3929
#[php_module]
40-
pub fn module(module: ModuleBuilder) -> ModuleBuilder {
41-
module
30+
mod module {
31+
/// Gives you a nice greeting!
32+
///
33+
/// @param string $name Your name.
34+
///
35+
/// @return string Nice greeting!
36+
#[php_function]
37+
pub fn hello_world(name: String) -> String {
38+
format!("Hello, {}!", name)
39+
}
4240
}

tests/sapi.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use ext_php_rs::ffi::{
88
php_module_shutdown, php_module_startup, php_request_shutdown, php_request_startup,
99
sapi_shutdown, sapi_startup, ZEND_RESULT_CODE_SUCCESS,
1010
};
11-
use ext_php_rs::prelude::*;
1211
use ext_php_rs::zend::try_catch_first;
12+
use ext_php_rs::{php_module, prelude::*};
1313
use std::ffi::c_char;
1414

1515
static mut LAST_OUTPUT: String = String::new();
@@ -82,17 +82,15 @@ fn test_sapi() {
8282
}
8383
}
8484

85-
/// Gives you a nice greeting!
86-
///
87-
/// @param string $name Your name.
88-
///
89-
/// @return string Nice greeting!
90-
#[php_function]
91-
pub fn hello_world(name: String) -> String {
92-
format!("Hello, {}!", name)
93-
}
94-
9585
#[php_module]
96-
pub fn module(module: ModuleBuilder) -> ModuleBuilder {
97-
module
86+
mod module {
87+
/// Gives you a nice greeting!
88+
///
89+
/// @param string $name Your name.
90+
///
91+
/// @return string Nice greeting!
92+
#[php_function]
93+
pub fn hello_world(name: String) -> String {
94+
format!("Hello, {}!", name)
95+
}
9896
}

0 commit comments

Comments
 (0)