Repository: cobalt-org/liquid-rust (rust)

Issue:
`split` of `Nil` should be empty array
Example test:
```rust
    assert_eq!(v!([]), filters!(split, Nil, v!(" ")));
```

- [Rust implementation](https://github.com/cobalt-org/liquid-rust/blob/master/src/filters/mod.rs)
- [Ruby implementation](https://github.com/Shopify/liquid/blob/master/lib/liquid/standardfilters.rb)
- [Relevant tests](https://github.com/cobalt-org/liquid-rust/search?q=liquid+263&unscoped_q=liquid+263)
  - Once this is working, ideally the test will start failing.  We would just need to remove the `#[should_panic]` on it
  - If the test doesn't start failing, please temporarily remove `#[should_panic]`, and find or create an issue for the new failure

Pull request description:
Split nil
fixes #263 


Patch:
diff --git a/crates/lib/src/stdlib/filters/string/mod.rs b/crates/lib/src/stdlib/filters/string/mod.rs
index 5d5e145..117483a 100644
--- a/crates/lib/src/stdlib/filters/string/mod.rs
+++ b/crates/lib/src/stdlib/filters/string/mod.rs
@@ -42,13 +42,17 @@ impl Filter for SplitFilter {
 
         let input = input.to_kstr();
 
-        // Split and construct resulting Array
-        Ok(Value::Array(
-            input
-                .split(args.pattern.as_str())
-                .map(|s| Value::scalar(s.to_owned()))
-                .collect(),
-        ))
+        if input.is_empty() {
+            Ok(Value::Array(Vec::new()))
+        } else {
+            // Split and construct resulting Array
+            Ok(Value::Array(
+                input
+                    .split(args.pattern.as_str())
+                    .map(|s| Value::scalar(s.to_owned()))
+                    .collect(),
+            ))
+        }
     }
 }
 
diff --git a/crates/lib/src/stdlib/filters/string/truncate.rs b/crates/lib/src/stdlib/filters/string/truncate.rs
index cd33010..7c50431 100644
--- a/crates/lib/src/stdlib/filters/string/truncate.rs
+++ b/crates/lib/src/stdlib/filters/string/truncate.rs
@@ -71,17 +71,17 @@ impl Filter for TruncateFilter {
     fn evaluate(&self, input: &dyn ValueView, runtime: &Runtime<'_>) -> Result<Value> {
         let args = self.args.evaluate(runtime)?;
 
-        let lenght = args.lenght.unwrap_or(50) as usize;
+        let length = args.lenght.unwrap_or(50) as usize;
         let truncate_string = args.ellipsis.unwrap_or_else(|| "...".into());
-        let diff = if lenght >= truncate_string.len() {
-            lenght - truncate_string.len()
+        let diff = if length >= truncate_string.len() {
+            length - truncate_string.len()
         } else {
             0
         };
         let l = cmp::max(diff, 0);
 
         let input_string = input.to_kstr();
-        let result = if lenght < input_string.len() {
+        let result = if length < input_string.len() {
             let result = UnicodeSegmentation::graphemes(input_string.as_str(), true)
                 .take(l)
                 .collect::<Vec<&str>>()


Test patch:
diff --git a/tests/conformance_ruby/standard_filter_test.rs b/tests/conformance_ruby/standard_filter_test.rs
index 703af94..bf5e7ff 100644
--- a/tests/conformance_ruby/standard_filter_test.rs
+++ b/tests/conformance_ruby/standard_filter_test.rs
@@ -170,7 +170,6 @@ fn test_truncate() {
 }
 
 #[test]
-#[should_panic] // liquid-rust#263
 fn test_split() {
     assert_eq!(
         v!(["12", "34"]),