aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/test2.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: encode derive: New default(skip) featureIan Jackson2026-06-221-0/+40
| | | | This lets us skip fields which have the default values.
* tor-netdoc: Replace ad-hoc pseudo-diff with unidiff from imra (fmt)Ian Jackson2026-06-111-4/+1
|
* tor-netdoc: Replace ad-hoc pseudo-diff with unidiff from imraIan Jackson2026-06-111-16/+1
| | | | | | And wrap it up nicely in an assert_eq_or_diff macro. I've tested the output by sabotaging one of the test2 tests.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* Merge branch 'parse2-more-debug' into 'main'Clara Engler2026-04-211-0/+1
|\ | | | | | | | | Add debugging support to ItemValueParseable derive See merge request tpo/core/arti!3881
| * tor-netdoc: Add debugging to ItemValueParseable, demo in testIan Jackson2026-04-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With cargo test --all-features -p tor-netdoc -- --no-capture test2 the output now contains, amongst many other things: netdoc TestItem parse: item start, "test-item", "N", Some("TEST OBJECT") netdoc TestItem parse: field needed, normal, args=1, "N" netdoc TestItem parse: field optional, normal, args=Option<_>, "" netdoc TestItem parse: field rest, normal, args=Vec<_>, "" netdoc TestItem parse: field object, object, object=1, Some(("TEST OBJECT", Ok(5))) netdoc TestItem parse: item complete Ok
* | tor-netdoc: Support `#[deftly(netdoc(skip))]` in itemsIan Jackson2026-04-201-0/+2
|/ | | | Ie for "arguments" that don't actually appear.
* tor-netdoc: parse2/encode derive: Use unquoted attributes at call sitesIan Jackson2026-04-071-10/+10
|
* tor-netdoc: derives: New `skip` document field optionIan Jackson2026-01-141-0/+3
| | | | | This lets us having document items that are "manually non exhaustive" which is necessary for struct literal constructors.
* tor-netdoc: test2: Make t_ok (which takes no boundaries) take &D not &[D]Ian Jackson2025-12-181-16/+16
|
* tor-netdoc: test2: Test parse_netdoc_multiple_with_offsetsIan Jackson2025-12-181-2/+25
| | | | | | * Make a fancy version of t_ok, t_ok_multi, that takes the expected boundary byte offsets. * t_ok is now just for single-document files and is implemented in terms of t_ok_multi. * Use t_ok_multi for the one test case with multiple documents.
* tor-netdoc: test2: Add a test file with more than one documentIan Jackson2025-12-181-0/+17
|
* tor-netdoc: rustfmtIan Jackson2025-12-181-2/+1
|
* tor-netdoc: Use $P for prelude in one placeIan Jackson2025-12-181-1/+1
| | | | This was missed, apparently.
* tor-netdoc: test2: check round-trip encodingIan Jackson2025-12-101-29/+162
| | | | | | | | | | | | | The test case documents are often not in canonical form. We don't want to change them to be in canonical form because we want to test parsing edge cases. So, we provide a mangling scheme with in-document notes, and annotate all the documents. Apply suitable annotations to all the documents. Test that the encoded forms are as expected. This reverts commit 05e7b8b60061a7e8a8d004a822cc213d3ea22d47.
* tor-netdoc: test2: implement encoding traits for all test typesIan Jackson2025-12-101-19/+58
| | | | | | | Make this whole module conditional on the encode feature. Apply the derives. Provide the necessary manual implementations for the types where we use `with`.
* tor-netdoc: test2: Don't ever have raw String in defaulted argumentsIan Jackson2025-12-041-9/+9
| | | | | | | These cannot be encoded. So that is logically incoherent. (Perhaps String ought not to be NormalItemArgument, but let's not tackle that now.)
* parse2: ItemValueParseable, netdoc(rest, with): reworkIan Jackson2025-12-021-2/+2
| | | | | | | | | | The path in `with` must always be a module, not a function, because we need to use it for encoding too. In the case of `rest`, it's probably sensible to require a different function name, given that the semantics are subtly different to those of `rest` without `with`, since the latter can only get a single word but with `rest` you get the whole line.
* tor-netdoc: test2: Run rustfmtIan Jackson2025-11-241-10/+2
| | | | Tidy up the imports.
* tor-netdoc: test2: Adjust type aliasesIan Jackson2025-11-241-14/+12
| | | | | | Now that this module is not inside parse2 its identifier namespace oughtn't to be parse-specific. Rename things so that every imports/aliases related to parsing implies parsing in its name.
* tor-netdoc: Move parse2/test.rs to test2.rsIan Jackson2025-11-241-0/+763
We're going to use this for the encoder testing too, so it needs to be not buried inside parse2. This commit is the file rename plus minimal changes to make it compile.