From 1ab7d2f2d75b3a3836a69d2330ce12983a0a8deb Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 4 Oct 2023 17:20:46 -0400 Subject: [PATCH] Add a test showing we are not handling exports flags properly. --- Makefile | 7 +++++++ .../lesser_element/lesser_block/example/exports_flag.org | 7 +++++++ .../lesser_element/lesser_block/src/exports_flag.org | 7 +++++++ .../lesser_block/src/{with_no_data.org => no_data.org} | 0 .../src/{with_space_after_end.org => space_after_end.org} | 0 src/parser/lesser_block.rs | 4 +--- src/types/lesser_element.rs | 1 - 7 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 org_mode_samples/lesser_element/lesser_block/example/exports_flag.org create mode 100644 org_mode_samples/lesser_element/lesser_block/src/exports_flag.org rename org_mode_samples/lesser_element/lesser_block/src/{with_no_data.org => no_data.org} (100%) rename org_mode_samples/lesser_element/lesser_block/src/{with_space_after_end.org => space_after_end.org} (100%) diff --git a/Makefile b/Makefile index 763a441..a7412bc 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,13 @@ dockertest: > $(MAKE) -C docker/organic_test > docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS) +.PHONY: buildtest +buildtest: +> cargo build --no-default-features +> cargo build --no-default-features --features compare +> cargo build --no-default-features --features tracing +> cargo build --no-default-features --features compare,tracing + .PHONY: foreign_document_test foreign_document_test: > $(MAKE) -C docker/organic_test run_foreign_document_test diff --git a/org_mode_samples/lesser_element/lesser_block/example/exports_flag.org b/org_mode_samples/lesser_element/lesser_block/example/exports_flag.org new file mode 100644 index 0000000..e9cc9b0 --- /dev/null +++ b/org_mode_samples/lesser_element/lesser_block/example/exports_flag.org @@ -0,0 +1,7 @@ +#+begin_example python :exports results +print("foo") +#+end_example + +#+begin_example python -n :exports results +print("foo") +#+end_example diff --git a/org_mode_samples/lesser_element/lesser_block/src/exports_flag.org b/org_mode_samples/lesser_element/lesser_block/src/exports_flag.org new file mode 100644 index 0000000..87c7fab --- /dev/null +++ b/org_mode_samples/lesser_element/lesser_block/src/exports_flag.org @@ -0,0 +1,7 @@ +#+begin_src python :exports results +print("foo") +#+end_src + +#+begin_src python -n :exports results +print("foo") +#+end_src diff --git a/org_mode_samples/lesser_element/lesser_block/src/with_no_data.org b/org_mode_samples/lesser_element/lesser_block/src/no_data.org similarity index 100% rename from org_mode_samples/lesser_element/lesser_block/src/with_no_data.org rename to org_mode_samples/lesser_element/lesser_block/src/no_data.org diff --git a/org_mode_samples/lesser_element/lesser_block/src/with_space_after_end.org b/org_mode_samples/lesser_element/lesser_block/src/space_after_end.org similarity index 100% rename from org_mode_samples/lesser_element/lesser_block/src/with_space_after_end.org rename to org_mode_samples/lesser_element/lesser_block/src/space_after_end.org diff --git a/src/parser/lesser_block.rs b/src/parser/lesser_block.rs index 2829366..5f909a6 100644 --- a/src/parser/lesser_block.rs +++ b/src/parser/lesser_block.rs @@ -104,7 +104,7 @@ pub(crate) fn comment_block<'b, 'g, 'r, 's>( context: RefContext<'b, 'g, 'r, 's>, input: OrgSource<'s>, ) -> Res, CommentBlock<'s>> { - let (remaining, name) = lesser_block_begin("comment")(context, input)?; + let (remaining, _name) = lesser_block_begin("comment")(context, input)?; let (remaining, _parameters) = opt(tuple((space1, data)))(remaining)?; let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?; let lesser_block_end_specialized = lesser_block_end("comment"); @@ -128,7 +128,6 @@ pub(crate) fn comment_block<'b, 'g, 'r, 's>( remaining, CommentBlock { source: source.into(), - name: name.into(), contents: contents.into(), }, )) @@ -384,7 +383,6 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res, ExampleSrcSw Ok((remaining, switches)) } -#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] fn example_src_switches( grab_language: bool, ) -> impl for<'s> Fn(OrgSource<'s>) -> Res, ExampleSrcSwitches<'s>> { diff --git a/src/types/lesser_element.rs b/src/types/lesser_element.rs index 76b2645..d8e21d6 100644 --- a/src/types/lesser_element.rs +++ b/src/types/lesser_element.rs @@ -32,7 +32,6 @@ pub struct VerseBlock<'s> { #[derive(Debug)] pub struct CommentBlock<'s> { pub source: &'s str, - pub name: &'s str, pub contents: &'s str, }