spec/cli_spec.rb in rubyc-0.1.2 vs spec/cli_spec.rb in rubyc-0.1.3
- old
+ new
@@ -71,9 +71,31 @@
@cli.uniq
end
out_str.must_equal "1\n2\n3\n"
end
+ it "should keep unique records grouped by a certain algorithm" do
+ out_str = local_io("aaaCoco\nbbbMomo\naaaBato\nbbbToto") do
+ @cli.uniq_by('[l[0,3], l[3..-1]]')
+ end
+ out_str.must_equal "Coco\nMomo\n"
+ end
+
+ it "should merge lines in group of n output them to stdout" do
+ out_str = local_io("1\n2\n3\n4\n5\n6\n7\n8") do
+ @cli.merge(3, ",")
+ end
+ out_str.must_equal "1,2,3\n4,5,6\n7,8\n"
+ end
+
+
+ it "should merge lines in group of n output them to stdout" do
+ out_str = local_io("1\n2\n3\n4\n5\n6\n7\n8") do
+ @cli.merge(3, ",")
+ end
+ out_str.must_equal "1,2,3\n4,5,6\n7,8\n"
+ end
+
it "should merge lines in group of n output them to stdout" do
out_str = local_io("1\n2\n3\n4\n5\n6\n7\n8") do
@cli.merge(3, ",")
end
out_str.must_equal "1,2,3\n4,5,6\n7,8\n"