Repository: tomekpiotrowski/lets_expect (rust)

Issue:
Use commas instead of semis in `when` variable declarations

Pull request description:
Use commas instead of semis in `when` variable declarations
Fixes #25

Patch:
diff --git a/lets_expect_core/src/core/when.rs b/lets_expect_core/src/core/when.rs
index 1cf8b0b..e87f21d 100644
--- a/lets_expect_core/src/core/when.rs
+++ b/lets_expect_core/src/core/when.rs
@@ -1,7 +1,7 @@
 use crate::core::to_ident::local_to_ident;
 use proc_macro2::{Ident, Span, TokenStream};
 use syn::punctuated::Punctuated;
-use syn::token::{Paren, Semi};
+use syn::token::{Comma, Paren};
 use syn::{braced, parenthesized, parse::Parse};
 
 use super::context::Context;
@@ -90,7 +90,7 @@ fn parse_lets_in_parentheses(
     let content;
     parenthesized!(content in input);
 
-    let when_lets: Punctuated<WhenLet, Semi> = Punctuated::parse_separated_nonempty(&content)?;
+    let when_lets: Punctuated<WhenLet, Comma> = Punctuated::parse_separated_nonempty(&content)?;
     let lets: Vec<Local> = when_lets.iter().map(WhenLet::to_local).collect();
 
     if lets.is_empty() {
diff --git a/src/lib.rs b/src/lib.rs
index 9f10d7a..d91cde3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -94,7 +94,7 @@
 //!         }
 //!     }
 //!
-//!     when(title = invalid_title; category_id = valid_category) { to be_err }
+//!     when(title = invalid_title, category_id = valid_category) { to be_err }
 //! }
 //! # }
 //! # }
@@ -370,7 +370,7 @@
 //!             to equal(10)
 //!         }
 //!
-//!         when(a = 10; b = 10) {
+//!         when(a = 10, b = 10) {
 //!             to equal(25)
 //!         }
 //!     }


Test patch:
diff --git a/tests/when.rs b/tests/when.rs
index 6701feb..29e8563 100644
--- a/tests/when.rs
+++ b/tests/when.rs
@@ -6,7 +6,7 @@ mod tests {
         expect(a + b + c) {
             when(a = 2) {
                 when (
-                    b = 1;
+                    b = 1,
                     c = 1
                 ) {
                     to equal_4 {
@@ -16,7 +16,7 @@ mod tests {
                 }
             }
 
-            when(a = 3; b = 3; c = 3) {
+            when(a = 3, b = 3, c = 3) {
                 to equal(9)
             }
 
@@ -36,5 +36,11 @@ mod tests {
                 to equal(-6)
             }
         }
+
+        expect(array) {
+            when(array = [1, 2, 3]) {
+                to equal([1, 2, 3])
+            }
+        }
     }
 }