From 2cc0d66c76895583f5b0c7c38b88d2bc6af8b4f9 Mon Sep 17 00:00:00 2001 From: Paula McMaw Date: Tue, 21 Feb 2017 15:39:46 +0000 Subject: Adding unit test for i18n concat function --- spec/functions/concat_spec.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/functions') diff --git a/spec/functions/concat_spec.rb b/spec/functions/concat_spec.rb index eb76233..0e67a60 100755 --- a/spec/functions/concat_spec.rb +++ b/spec/functions/concat_spec.rb @@ -12,6 +12,7 @@ describe 'concat' do it { is_expected.to run.with_params(['1','2'],['3','4'],['5','6']).and_return(['1','2','3','4','5','6']) } it { is_expected.to run.with_params(['1','2'],'3','4',['5','6']).and_return(['1','2','3','4','5','6']) } it { is_expected.to run.with_params([{"a" => "b"}], {"c" => "d", "e" => "f"}).and_return([{"a" => "b"}, {"c" => "d", "e" => "f"}]) } + it { is_expected.to run.with_params(['ấ','β','c'],['đ','ể','ƒ']).and_return(['ấ','β','c','đ','ể','ƒ']) } it "should leave the original array intact" do argument1 = ['1','2','3'] -- cgit v1.2.3 From 68fa8d32511e770498118b9c1ccc1dfd1e89c860 Mon Sep 17 00:00:00 2001 From: Paula McMaw Date: Tue, 21 Feb 2017 15:40:04 +0000 Subject: Adding unit test for i18n count function --- spec/functions/count_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec/functions') diff --git a/spec/functions/count_spec.rb b/spec/functions/count_spec.rb index c8d1960..3854cb8 100755 --- a/spec/functions/count_spec.rb +++ b/spec/functions/count_spec.rb @@ -15,4 +15,9 @@ describe 'count' do it { is_expected.to run.with_params(["one", nil, "two"]).and_return(2) } it { is_expected.to run.with_params(["one", "", "two"]).and_return(2) } it { is_expected.to run.with_params(["one", :undef, "two"]).and_return(2) } + + it { is_expected.to run.with_params(["ổņ℮", "ŧщộ", "three"]).and_return(3) } + it { is_expected.to run.with_params(["ổņ℮", "ŧщộ", "ŧщộ"], "ŧщộ").and_return(2) } + it { is_expected.to run.with_params(["ổņ℮", nil, "ŧщộ"]).and_return(2) } + it { is_expected.to run.with_params(["ổņ℮", :undef, "ŧщộ"]).and_return(2) } end -- cgit v1.2.3 From 83d68fef749869dc917539f7f05592dc2f2ce642 Mon Sep 17 00:00:00 2001 From: Paula McMaw Date: Tue, 21 Feb 2017 15:51:59 +0000 Subject: Adding unit test for i18n delete function --- spec/functions/delete_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'spec/functions') diff --git a/spec/functions/delete_spec.rb b/spec/functions/delete_spec.rb index b44accf..4e37865 100755 --- a/spec/functions/delete_spec.rb +++ b/spec/functions/delete_spec.rb @@ -19,6 +19,7 @@ describe 'delete' do it { is_expected.to run.with_params(['one', 'two', 'three'], 'two').and_return(['one', 'three']) } it { is_expected.to run.with_params(['two', 'one', 'two', 'three', 'two'], 'two').and_return(['one', 'three']) } it { is_expected.to run.with_params(['one', 'two', 'three', 'two'], ['one', 'two']).and_return(['three']) } + it { is_expected.to run.with_params(['ồאּẻ', 'ŧẅơ', 'ŧңŗё℮', 'ŧẅơ'], ['ồאּẻ', 'ŧẅơ']).and_return(['ŧңŗё℮']) } end describe 'deleting from a string' do @@ -30,7 +31,8 @@ describe 'delete' do it { is_expected.to run.with_params('barfoobar', 'bar').and_return('foo') } it { is_expected.to run.with_params('foobarbabarz', 'bar').and_return('foobaz') } it { is_expected.to run.with_params('foobarbabarz', ['foo', 'bar']).and_return('baz') } - # this is so sick + it { is_expected.to run.with_params('ƒōōβậяβậβậяź', ['ƒōō', 'βậя']).and_return('βậź') } + it { is_expected.to run.with_params('barfoobar', ['barbar', 'foo']).and_return('barbar') } it { is_expected.to run.with_params('barfoobar', ['foo', 'barbar']).and_return('') } end @@ -47,6 +49,10 @@ describe 'delete' do .with_params({'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}, ['key1', 'key2']) \ .and_return( {'key3' => 'value3'}) } + it { is_expected.to run \ + .with_params({'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3'}, ['ĸəұ1', 'ĸəұ2']) \ + .and_return( {'ĸəұ3' => 'νãŀủĕ3'}) + } end it "should leave the original array intact" do -- cgit v1.2.3 From 846ddcd09e1a5bf27acb6cb5fd1e0854bb1538f6 Mon Sep 17 00:00:00 2001 From: Paula McMaw Date: Tue, 21 Feb 2017 16:01:06 +0000 Subject: Adding unit test for i18n delete_at function --- spec/functions/delete_at_spec.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'spec/functions') diff --git a/spec/functions/delete_at_spec.rb b/spec/functions/delete_at_spec.rb index 0e19472..0471039 100755 --- a/spec/functions/delete_at_spec.rb +++ b/spec/functions/delete_at_spec.rb @@ -18,6 +18,8 @@ describe 'delete_at' do it { is_expected.to run.with_params([0, 1, 2], 1).and_return([0, 2]) } it { is_expected.to run.with_params([0, 1, 2], -1).and_return([0, 1]) } it { is_expected.to run.with_params([0, 1, 2], -4).and_return([0, 1, 2]) } + it { is_expected.to run.with_params(["ƒờở", "βāř", "ьầż"], 1).and_return(["ƒờở", "ьầż"]) } + it "should leave the original array intact" do argument = [1, 2, 3] -- cgit v1.2.3 From 150696a028d047321e9e53081d0922e039a66312 Mon Sep 17 00:00:00 2001 From: Paula McMaw Date: Tue, 21 Feb 2017 16:04:47 +0000 Subject: Adding unit test for i18n delete_value function --- spec/functions/delete_values_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'spec/functions') diff --git a/spec/functions/delete_values_spec.rb b/spec/functions/delete_values_spec.rb index 12907d4..329fa0b 100755 --- a/spec/functions/delete_values_spec.rb +++ b/spec/functions/delete_values_spec.rb @@ -19,7 +19,11 @@ describe 'delete_values' do .and_return({'key1' => 'value1'}) } it { is_expected.to run \ - .with_params({'key1' => 'value1', 'key2' => 'value to delete'}, 'value to delete') \ + .with_params({'ҝếỵ1 ' => 'νâĺūẹ1', 'ҝếỵ2' => 'value to delete'}, 'value to delete') \ + .and_return({'ҝếỵ1 ' => 'νâĺūẹ1'}) + } + it { is_expected.to run \ + .with_params({'key1' => 'value1', 'key2' => 'νǎŀữ℮ ťớ đêłểťė'}, 'νǎŀữ℮ ťớ đêłểťė') \ .and_return({'key1' => 'value1'}) } it { is_expected.to run \ -- cgit v1.2.3