diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 00:51:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 00:51:40 +0900 |
| commit | 53f027302ebcb91f6fb9b177f5e7e9e2d00c5089 (patch) | |
| tree | 8e5253105ca5abea99208cc47caae3fb118f734a /crates/shirabe/tests/io | |
| parent | 7bea9042a79d3cbfe31cc2595e8b8c6a3788ba15 (diff) | |
| download | php-shirabe-53f027302ebcb91f6fb9b177f5e7e9e2d00c5089.tar.gz php-shirabe-53f027302ebcb91f6fb9b177f5e7e9e2d00c5089.tar.zst php-shirabe-53f027302ebcb91f6fb9b177f5e7e9e2d00c5089.zip | |
test: port BufferIO, Runtime, JsonValidationException tests
JsonValidationExceptionTest passes. BufferIOTest (set_user_inputs is todo!())
and RuntimeTest (html_entity_decode is todo!()) are marked #[ignore].
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/io')
| -rw-r--r-- | crates/shirabe/tests/io/buffer_io_test.rs | 27 | ||||
| -rw-r--r-- | crates/shirabe/tests/io/main.rs | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/crates/shirabe/tests/io/buffer_io_test.rs b/crates/shirabe/tests/io/buffer_io_test.rs index c3e9876..67e6ab4 100644 --- a/crates/shirabe/tests/io/buffer_io_test.rs +++ b/crates/shirabe/tests/io/buffer_io_test.rs @@ -1 +1,28 @@ //! ref: composer/tests/Composer/Test/IO/BufferIOTest.php + +use shirabe::io::buffer_io::BufferIO; +use shirabe::io::IOInterfaceImmutable; +use shirabe_external_packages::symfony::console::output::output_interface::VERBOSITY_NORMAL; +use shirabe_php_shim::PhpMixed; + +#[test] +#[ignore = "BufferIO::set_user_inputs is todo!() (needs StreamableInputInterface downcast wiring)"] +fn test_set_user_inputs() { + let mut buffer_io = BufferIO::new(String::new(), VERBOSITY_NORMAL, None).unwrap(); + + // The Rust port always uses a StreamableInputInterface, so the version-guard + // exception branch in the original test does not apply. + buffer_io + .set_user_inputs(vec!["yes".to_string(), "no".to_string(), String::new()]) + .unwrap(); + + assert!(buffer_io.ask_confirmation("Please say yes!".to_string(), false)); + assert!(!buffer_io.ask_confirmation("Now please say no!".to_string(), true)); + assert_eq!( + PhpMixed::String("default".to_string()), + buffer_io.ask( + "Empty string last".to_string(), + PhpMixed::String("default".to_string()) + ) + ); +} diff --git a/crates/shirabe/tests/io/main.rs b/crates/shirabe/tests/io/main.rs new file mode 100644 index 0000000..00f19c8 --- /dev/null +++ b/crates/shirabe/tests/io/main.rs @@ -0,0 +1 @@ +mod buffer_io_test; |
