From b5aba69e60dec153ecab3263ebc3fa5e93662a46 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 15 Apr 2019 09:22:11 +0000 Subject: merge revision(s) 66720: separate downloading of Unicode property files and auxiliary files Separate downloading of Unicode property files in ucd and in ucd/auxiliary. This is needed because we need information from separate index.html files to discover the exact file names of property files during a beta period. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/csv/write/test_converters.rb | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/csv/write/test_converters.rb (limited to 'test/csv/write') diff --git a/test/csv/write/test_converters.rb b/test/csv/write/test_converters.rb new file mode 100644 index 0000000000..a93b1040ac --- /dev/null +++ b/test/csv/write/test_converters.rb @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# frozen_string_literal: false + +require_relative "../helper" + +module TestCSVWriteConverters + def test_one + assert_equal(%Q[=a,=b,=c\n], + generate_line(["a", "b", "c"], + write_converters: ->(value) {"=" + value})) + end + + def test_multiple + assert_equal(%Q[=a_,=b_,=c_\n], + generate_line(["a", "b", "c"], + write_converters: [ + ->(value) {"=" + value}, + ->(value) {value + "_"}, + ])) + end + + def test_nil_value + assert_equal(%Q[a,NaN,c\n], + generate_line(["a", nil, "c"], + write_nil_value: "NaN")) + end + + def test_empty_value + assert_equal(%Q[a,,c\n], + generate_line(["a", "", "c"], + write_empty_value: nil)) + end +end + +class TestCSVWriteConvertersGenerateLine < Test::Unit::TestCase + include TestCSVWriteConverters + extend DifferentOFS + + def generate_line(row, **kwargs) + CSV.generate_line(row, **kwargs) + end +end + +class TestCSVWriteConvertersGenerate < Test::Unit::TestCase + include TestCSVWriteConverters + extend DifferentOFS + + def generate_line(row, **kwargs) + CSV.generate(**kwargs) do |csv| + csv << row + end + end +end -- cgit v1.2.3