Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit763d8eb

Browse files
authored
feat: Enhance logging and testing utilities (#215)
1 parenta21896f commit763d8eb

File tree

16 files changed

+426
-195
lines changed

16 files changed

+426
-195
lines changed

‎Cargo.lock

Lines changed: 80 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎examples/complex/build.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,5 @@
99
// See the Mulan PSL v2 for more details.
1010

1111
fnmain(){
12-
phper_build::register_configures();
13-
14-
#[cfg(target_os ="macos")]
15-
{
16-
println!("cargo:rustc-link-arg=-undefined");
17-
println!("cargo:rustc-link-arg=dynamic_lookup");
18-
}
12+
phper_build::register_all();
1913
}

‎examples/complex/tests/integration.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,29 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
use phper_test::{cli::test_php_scripts, utils::get_lib_path};
11+
use phper_test::{cargo::CargoBuilder, cli::test_php_script, log};
1212
use std::{
1313
env,
1414
path::{Path,PathBuf},
15+
sync::LazyLock,
1516
};
1617

18+
pubstaticDYLIB_PATH:LazyLock<PathBuf> =LazyLock::new(||{
19+
log::setup();
20+
let result =CargoBuilder::new()
21+
.current_dir(env!("CARGO_MANIFEST_DIR"))
22+
.build()
23+
.unwrap();
24+
result.get_cdylib().unwrap()
25+
});
26+
27+
pubstaticTESTS_PHP_DIR:LazyLock<PathBuf> =LazyLock::new(||{
28+
Path::new(env!("CARGO_MANIFEST_DIR"))
29+
.join("tests")
30+
.join("php")
31+
});
32+
1733
#[test]
1834
fntest_php(){
19-
test_php_scripts(
20-
get_lib_path(
21-
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
22-
.join("..")
23-
.join("..")
24-
.join("target"),
25-
"complex",
26-
),
27-
&[&Path::new(env!("CARGO_MANIFEST_DIR"))
28-
.join("tests")
29-
.join("php")
30-
.join("test.php")],
31-
);
35+
test_php_script(&*DYLIB_PATH,TESTS_PHP_DIR.join("test.php"));
3236
}

‎examples/http-client/tests/integration.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,29 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
use phper_test::{cli::test_php_scripts, utils::get_lib_path};
11+
use phper_test::{cargo::CargoBuilder, cli::test_php_script, log};
1212
use std::{
1313
env,
1414
path::{Path,PathBuf},
15+
sync::LazyLock,
1516
};
1617

18+
pubstaticDYLIB_PATH:LazyLock<PathBuf> =LazyLock::new(||{
19+
log::setup();
20+
let result =CargoBuilder::new()
21+
.current_dir(env!("CARGO_MANIFEST_DIR"))
22+
.build()
23+
.unwrap();
24+
result.get_cdylib().unwrap()
25+
});
26+
27+
pubstaticTESTS_PHP_DIR:LazyLock<PathBuf> =LazyLock::new(||{
28+
Path::new(env!("CARGO_MANIFEST_DIR"))
29+
.join("tests")
30+
.join("php")
31+
});
32+
1733
#[test]
1834
fntest_php(){
19-
test_php_scripts(
20-
get_lib_path(
21-
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
22-
.join("..")
23-
.join("..")
24-
.join("target"),
25-
"http_client",
26-
),
27-
&[&Path::new(env!("CARGO_MANIFEST_DIR"))
28-
.join("tests")
29-
.join("php")
30-
.join("test.php")],
31-
);
35+
test_php_script(&*DYLIB_PATH,TESTS_PHP_DIR.join("test.php"));
3236
}

‎examples/http-server/tests/integration.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,29 @@
1010

1111
use axum::http::header::CONTENT_TYPE;
1212
use hyper::StatusCode;
13-
use phper_test::{cli::test_long_term_php_script_with_condition, utils::get_lib_path};
13+
use phper_test::{cargo::CargoBuilder, cli::test_long_term_php_script_with_condition, log};
1414
use reqwest::blocking::Client;
1515
use std::{
1616
env,
1717
path::{Path,PathBuf},
18+
sync::LazyLock,
1819
thread::sleep,
1920
time::Duration,
2021
};
2122

23+
pubstaticDYLIB_PATH:LazyLock<PathBuf> =LazyLock::new(||{
24+
log::setup();
25+
let result =CargoBuilder::new()
26+
.current_dir(env!("CARGO_MANIFEST_DIR"))
27+
.build()
28+
.unwrap();
29+
result.get_cdylib().unwrap()
30+
});
31+
2232
#[test]
2333
fntest_php(){
2434
test_long_term_php_script_with_condition(
25-
get_lib_path(
26-
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
27-
.join("..")
28-
.join("..")
29-
.join("target"),
30-
"http_server",
31-
),
35+
&*DYLIB_PATH,
3236
Path::new(env!("CARGO_MANIFEST_DIR"))
3337
.join("tests")
3438
.join("php")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp