@@ -560,26 +560,6 @@ def test_map_returns_empty_on_2d_input_array
560560 end
561561 end
562562
563- def test_map_with_nil_property
564- array = [
565- { "handle" => "alpha" , "value" => "A" } ,
566- { "handle" => "beta" , "value" => "B" } ,
567- { "handle" => "gamma" , "value" => "C" }
568- ]
569-
570- assert_template_result ( "alpha beta gamma" , "{{ array | map: nil | map: 'handle' | join: ' ' }}" , { "array" => array } )
571- end
572-
573- def test_map_with_empty_string_property
574- array = [
575- { "handle" => "alpha" , "value" => "A" } ,
576- { "handle" => "beta" , "value" => "B" } ,
577- { "handle" => "gamma" , "value" => "C" }
578- ]
579-
580- assert_template_result ( "alpha beta gamma" , "{{ array | map: '' | map: 'handle' | join: ' ' }}" , { "array" => array } )
581- end
582-
583563 def test_map_with_value_property
584564 array = [
585565 { "handle" => "alpha" , "value" => "A" } ,
@@ -591,16 +571,15 @@ def test_map_with_value_property
591571 end
592572
593573 def test_map_returns_input_with_no_property
594- input = [
574+ foo = [
595575 [ 1 ] ,
596576 [ 2 ] ,
597577 [ 3 ] ,
598578 ]
599- result = @filters . map ( input , nil )
600- assert_equal ( input . flatten , result )
601579
602- result = @filters . map ( input , '' )
603- assert_equal ( input . flatten , result )
580+ assert_raises ( Liquid ::ArgumentError ) do
581+ @filters . map ( foo , nil )
582+ end
604583 end
605584
606585 def test_sort_works_on_enumerables
@@ -1109,19 +1088,6 @@ def test_where_with_false_value
11091088 assert_template_result ( expected_output , template , { "array" => array } )
11101089 end
11111090
1112- def test_where_with_non_string_property
1113- array = [
1114- { "handle" => "alpha" , "{}" => true } ,
1115- { "handle" => "beta" , "{}" => false } ,
1116- { "handle" => "gamma" , "{}" => false } ,
1117- { "handle" => "delta" , "{}" => true } ,
1118- ]
1119- template = "{{ array | where: some_property, true | map: 'handle' | join: ' ' }}"
1120- expected_output = "alpha delta"
1121-
1122- assert_template_result ( expected_output , template , { "array" => array , "some_property" => { } } )
1123- end
1124-
11251091 def test_where_string_keys
11261092 input = [
11271093 "alpha" , "beta" , "gamma" , "delta"
@@ -1330,7 +1296,7 @@ def test_sum_with_floats_and_indexable_map_values
13301296 end
13311297
13321298 def test_sum_with_non_string_property
1333- input = [ { " true" => 1 } , { " 1.0" => 0.2 , "1" => -0.3 } , { " 1..5" => 0.4 } ]
1299+ input = [ { true => 1 } , { 1.0 => 0.2 , 1 => -0.3 } , { 1 ..5 => 0.4 } ]
13341300
13351301 assert_equal ( 1 , @filters . sum ( input , true ) )
13361302 assert_equal ( 0.2 , @filters . sum ( input , 1.0 ) )
0 commit comments