Skip to content

Commit b0d34d8

Browse files
authored
Clean up public API leaks (#64)
* Clean up public API leaks * Consolidate to single name for remote-tests * Bump version too
1 parent 9024757 commit b0d34d8

9 files changed

Lines changed: 13 additions & 29 deletions

File tree

.github/workflows/build.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,10 @@ jobs:
102102
fi
103103
echo "Found $(find picojson/tests/data/JSONTestSuite/test_parsing -name '*.json' | wc -l) conformance test files"
104104
105-
- name: Run JSONTestSuite conformance tests
105+
- name: Run JSONTestSuite and JSON_checker conformance tests
106106
working-directory: picojson
107107
run: cargo test --features remote-tests
108108
continue-on-error: true
109109

110-
- name: Run JSON_checker conformance tests
111-
working-directory: picojson
112-
run: cargo test --features remote-tests,json-checker-tests
113-
continue-on-error: true
114-
115110
- name: Report conformance test results
116111
run: echo "::notice::All conformance tests completed - check logs above for any failures"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ Cargo.lock
2323

2424
# Downloaded conformance test files
2525
**/conformance_tests/
26+
picojson/tests/data/json_checker/
27+
picojson/tests/data/JSONTestSuite/
28+
picojson/tests/conformance_generated.rs

picojson/Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "picojson"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55
license = "Apache-2.0"
66
exclude = ["/.github/**"]
@@ -33,12 +33,9 @@ float-skip = [] # Skip float values during parsing (continue with next t
3333
float-error = [] # Error when encountering floats
3434
float-truncate = [] # Truncate floats to integers (1.7 → 1)
3535

36-
# Remote conformance testing
36+
# Remote conformance test suites
3737
remote-tests = ["dep:ureq", "dep:zip"]
3838

39-
# JSON_checker test suite from json.org
40-
json-checker-tests = []
41-
4239
[package.metadata.conformance-tests]
4340
# JSONTestSuite configuration
4441
jsontest-suite-url = "https://github.com/nst/JSONTestSuite/archive/{commit}.zip"

picojson/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fn get_jsontest_suite_commit() -> String {
177177
.unwrap_or_else(|_| "1ef36fa01286573e846ac449e8683f8833c5b26a".to_string())
178178
}
179179

180-
#[cfg(feature = "json-checker-tests")]
180+
#[cfg(feature = "remote-tests")]
181181
fn get_json_checker_url() -> String {
182182
std::env::var("CARGO_PKG_METADATA_CONFORMANCE_TESTS_JSON_CHECKER_URL")
183183
.unwrap_or_else(|_| "https://www.json.org/JSON_checker/test.zip".to_string())
@@ -266,7 +266,7 @@ fn download_json_test_suite() -> Result<(), Box<dyn std::error::Error>> {
266266
Ok(())
267267
}
268268

269-
#[cfg(feature = "json-checker-tests")]
269+
#[cfg(feature = "remote-tests")]
270270
fn download_json_checker() -> Result<(), Box<dyn std::error::Error>> {
271271
use std::fs;
272272
use std::io::{self, Read};
@@ -344,7 +344,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
344344
download_json_test_suite()?;
345345
}
346346

347-
#[cfg(feature = "json-checker-tests")]
347+
#[cfg(feature = "remote-tests")]
348348
{
349349
download_json_checker()?;
350350
}
@@ -353,7 +353,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
353353
#[cfg(feature = "remote-tests")]
354354
{
355355
generate_conformance_tests()?;
356-
println!("cargo:warning=You can now run conformance tests with: cargo test --features remote-tests,json-checker-tests");
356+
println!("cargo:warning=You can now run conformance tests with: cargo test --features remote-tests");
357357
}
358358

359359
Ok(())

picojson/src/event_processor.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,6 @@ pub trait ContentExtractor {
220220
finished: bool,
221221
) -> Result<Event<'_, '_>, ParseError>;
222222

223-
/// Check if the underlying source is finished (e.g., EOF for a stream).
224-
/// The default is `true`, suitable for complete sources like slices.
225-
fn is_finished(&self) -> bool {
226-
true
227-
}
228-
229223
/// Shared validation and extraction for string content
230224
fn validate_and_extract_string(&mut self) -> Result<Event<'_, '_>, ParseError> {
231225
let start_pos = match *self.parser_state() {

picojson/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ mod shared;
8080
pub use shared::{Event, PullParser};
8181

8282
mod event_processor;
83-
pub use event_processor::{EscapeTiming, ParserCore};
8483

8584
mod slice_input_buffer;
8685

picojson/src/slice_content_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! ContentBuilder implementation for SliceParser using CopyOnEscape optimization.
44
55
use crate::copy_on_escape::CopyOnEscape;
6-
use crate::escape_processor::UnicodeEscapeCollector;
6+
use crate::escape_processor::{self, UnicodeEscapeCollector};
77
use crate::event_processor::ContentExtractor;
88
use crate::shared::{ContentRange, State};
99
use crate::slice_input_buffer::{InputBuffer, SliceInputBuffer};
@@ -124,7 +124,7 @@ impl ContentExtractor for SliceContentBuilder<'_, '_> {
124124
let had_pending_high_surrogate = self.unicode_escape_collector.has_pending_high_surrogate();
125125

126126
let (utf8_bytes_result, escape_start_pos) =
127-
crate::escape_processor::process_unicode_escape_sequence(
127+
escape_processor::process_unicode_escape_sequence(
128128
current_pos,
129129
&mut self.unicode_escape_collector,
130130
hex_slice_provider,

picojson/src/stream_content_builder.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,6 @@ impl<R: Reader> ContentExtractor for StreamContentBuilder<'_, R> {
259259
Ok(Event::Number(json_number))
260260
}
261261

262-
fn is_finished(&self) -> bool {
263-
self.finished
264-
}
265-
266262
fn validate_and_extract_number(
267263
&mut self,
268264
from_container_end: bool,

picojson/tests/json_checker_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! This provides complementary validation to JSONTestSuite with focused
1313
//! testing of specific JSON specification violations.
1414
15-
#[cfg(feature = "json-checker-tests")]
15+
#[cfg(feature = "remote-tests")]
1616
mod json_checker_tests {
1717
use picojson::{Event, ParseError, PullParser, SliceParser};
1818
use std::fs;

0 commit comments

Comments
 (0)