From 6f9e8abfa72dd1f4bdaef6bbf57e1981f16604fc Mon Sep 17 00:00:00 2001 From: Dominik Nakamura Date: Fri, 3 Nov 2023 15:31:50 +0900 Subject: [PATCH] test: add playground sample for tuple structs To ensure the tuple variant is working and doesn't include oversights like the previous missing `pub` visibility modifier. --- crates/stef-playground/src/lib.rs | 5 +++++ crates/stef-playground/src/sample.stef | 3 +++ 2 files changed, 8 insertions(+) diff --git a/crates/stef-playground/src/lib.rs b/crates/stef-playground/src/lib.rs index 3922e4c..4fcc2db 100644 --- a/crates/stef-playground/src/lib.rs +++ b/crates/stef-playground/src/lib.rs @@ -159,6 +159,11 @@ mod tests { }); } + #[test] + fn sample3() { + roundtrip(&sample::Sample3(true, (vec![1, 2, 3, 4, 5], -500_000))); + } + #[test] fn sample_gen() { roundtrip(&sample::gens::SampleGen { diff --git a/crates/stef-playground/src/sample.stef b/crates/stef-playground/src/sample.stef index 5e74576..01c083e 100644 --- a/crates/stef-playground/src/sample.stef +++ b/crates/stef-playground/src/sample.stef @@ -16,6 +16,9 @@ enum Sample2 { } @3, } +/// A tuple struct. +struct Sample3(bool @1, (bytes, i64) @2) + const CHRISTMAS_MONTH: u8 = 12; const CHRISTMAS_DAY: u8 = 24;