Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions picojson/src/escape_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ impl UnicodeEscapeCollector {
#[cfg(test)]
mod tests {
use super::*;
use crate::ujson::EventToken;

#[test]
fn test_simple_escapes() {
Expand Down Expand Up @@ -375,8 +376,6 @@ mod tests {

#[test]
fn test_token_to_escape_char() {
use crate::ujson::EventToken;

// Test all valid escape tokens
assert_eq!(
EscapeProcessor::token_to_escape_char(&EventToken::EscapeQuote).unwrap(),
Expand Down Expand Up @@ -420,8 +419,6 @@ mod tests {

#[test]
fn test_process_escape_token() {
use crate::ujson::EventToken;

// Test valid escape tokens that produce correct unescaped bytes
assert_eq!(
EscapeProcessor::process_escape_token(&EventToken::EscapeQuote).unwrap(),
Expand Down
5 changes: 1 addition & 4 deletions picojson/src/stream_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl<'a> StreamBuffer<'a> {
#[cfg(test)]
mod tests {
use super::*;
use crate::shared::State;

#[test]
fn test_lifetime_expectations() {
Expand Down Expand Up @@ -718,7 +719,6 @@ mod tests {
if _string_start_pos < offset {
// Original string start was discarded - must use escape/copy mode
// In real implementation, parser would copy what it had processed to unescaped buffer
println!("String start was discarded, switching to escape mode");
_string_start_pos = 0; // Reset for escape mode
} else {
_string_start_pos = _string_start_pos.saturating_sub(offset); // Normal position update
Expand Down Expand Up @@ -917,9 +917,6 @@ mod tests {
fn test_position_update_state_transitions() {
// Test the complete state transition logic for different parser states

// Mock the State enum variants and position update logic
use crate::shared::State;

// Case 1: State::None - no position to update
let state = State::None;
// No position updates needed for None state
Expand Down
4 changes: 2 additions & 2 deletions picojson/src/stream_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ impl<'b, R: Reader, C: BitStackConfig> EscapeHandler for StreamParser<'b, R, C>
// StreamParser handles all escape sequences the same way - append bytes to escape buffer
// Use safe slice access to avoid panic
if let Some(valid_bytes) = utf8_bytes.get(..len) {
for &byte in valid_bytes {
self.append_byte_to_escape_buffer(byte)?;
for &byte in valid_bytes {
self.append_byte_to_escape_buffer(byte)?;
}
}
}
Expand Down
Loading