Skip to content

Commit 062b2a8

Browse files
committed
test(data_structures): enable doc tests for oxc_data_structures crate (#9884)
Enable doctests for `oxc_data_structures`, and fix the failures in those tests.
1 parent 723fdfb commit 062b2a8

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

crates/oxc_data_structures/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ workspace = true
1818

1919
[lib]
2020
test = true
21-
doctest = false
21+
doctest = true
2222

2323
[dependencies]
2424
assert-unchecked = { workspace = true, optional = true }

crates/oxc_data_structures/src/code_buffer.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use assert_unchecked::assert_unchecked;
1414
///
1515
/// # Example
1616
/// ```
17-
/// # use oxc_data_structures::CodeBuffer;
17+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
1818
/// let mut code = CodeBuffer::new();
1919
///
2020
/// // mock settings
@@ -42,7 +42,7 @@ impl CodeBuffer {
4242
///
4343
/// # Example
4444
/// ```
45-
/// # use oxc_data_structures::CodeBuffer;
45+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
4646
/// let mut code = CodeBuffer::new();
4747
///
4848
/// // use `code` to build new source text
@@ -92,7 +92,7 @@ impl CodeBuffer {
9292
///
9393
/// # Example
9494
/// ```
95-
/// # use oxc_data_structures::CodeBuffer;
95+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
9696
/// let mut code = CodeBuffer::new();
9797
/// assert!(code.is_empty());
9898
///
@@ -115,7 +115,7 @@ impl CodeBuffer {
115115
///
116116
/// # Example
117117
/// ```
118-
/// # use oxc_data_structures::CodeBuffer;
118+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
119119
/// let mut code = CodeBuffer::default();
120120
/// code.reserve(10);
121121
/// ```
@@ -131,7 +131,7 @@ impl CodeBuffer {
131131
///
132132
/// # Example
133133
/// ```
134-
/// # use oxc_data_structures::CodeBuffer;
134+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
135135
/// let mut code = CodeBuffer::new();
136136
/// code.print_str("foo");
137137
///
@@ -160,7 +160,7 @@ impl CodeBuffer {
160160
///
161161
/// # Example
162162
/// ```
163-
/// # use oxc_data_structures::CodeBuffer;
163+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
164164
/// let mut code = CodeBuffer::new();
165165
/// code.print_str("foo");
166166
///
@@ -194,7 +194,7 @@ impl CodeBuffer {
194194
///
195195
/// # Example
196196
/// ```
197-
/// # use oxc_data_structures::CodeBuffer;
197+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
198198
/// let mut code = CodeBuffer::new();
199199
/// code.print_ascii_byte(b'f');
200200
/// code.print_ascii_byte(b'o');
@@ -234,7 +234,7 @@ impl CodeBuffer {
234234
///
235235
/// # Example
236236
/// ```
237-
/// # use oxc_data_structures::CodeBuffer;
237+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
238238
/// let mut code = CodeBuffer::new();
239239
/// // Safe: 'a' is a valid ASCII character. Its UTF-8 representation only
240240
/// // requires a single byte.
@@ -295,7 +295,7 @@ impl CodeBuffer {
295295
///
296296
/// # Example
297297
/// ```
298-
/// # use oxc_data_structures::CodeBuffer;
298+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
299299
/// let mut code = CodeBuffer::new();
300300
///
301301
/// code.print_char('f');
@@ -317,7 +317,7 @@ impl CodeBuffer {
317317
///
318318
/// # Example
319319
/// ```
320-
/// # use oxc_data_structures::CodeBuffer;
320+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
321321
/// let mut code = CodeBuffer::new();
322322
/// code.print_str("function main() { console.log('Hello, world!') }");
323323
/// ```
@@ -333,7 +333,7 @@ impl CodeBuffer {
333333
///
334334
/// # Example
335335
/// ```
336-
/// # use oxc_data_structures::CodeBuffer;
336+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
337337
/// let mut code = CodeBuffer::new();
338338
///
339339
/// code.print_ascii_bytes([b'f', b'o', b'o']);
@@ -366,7 +366,7 @@ impl CodeBuffer {
366366
///
367367
/// # Example
368368
/// ```
369-
/// # use oxc_data_structures::CodeBuffer;
369+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
370370
/// let mut code = CodeBuffer::new();
371371
///
372372
/// // SAFETY: All bytes in this slice are ASCII
@@ -396,7 +396,7 @@ impl CodeBuffer {
396396
///
397397
/// # Example
398398
/// ```
399-
/// # use oxc_data_structures::CodeBuffer;
399+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
400400
/// let mut code = CodeBuffer::new();
401401
///
402402
/// // SAFETY: All values yielded by this iterator are ASCII bytes
@@ -462,7 +462,7 @@ impl CodeBuffer {
462462
///
463463
/// # Example
464464
/// ```
465-
/// # use oxc_data_structures::CodeBuffer;
465+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
466466
/// let mut code = CodeBuffer::new();
467467
/// code.print_str("foo");
468468
/// assert_eq!(code.as_bytes(), &[b'f', b'o', b'o']);
@@ -476,7 +476,7 @@ impl CodeBuffer {
476476
///
477477
/// # Example
478478
/// ```
479-
/// # use oxc_data_structures::CodeBuffer;
479+
/// # use oxc_data_structures::code_buffer::CodeBuffer;
480480
/// let mut code = CodeBuffer::new();
481481
/// code.print_str("console.log('foo');");
482482
///

0 commit comments

Comments
 (0)