class TestCSVTokenizer
Public Instance Methods
ok(e, s)
click to toggle source
# File vendor/qwik/lib/qwik/util-csv-tokenizer.rb, line 72 def ok(e, s) assert_equal e, CSVTokenizer.csv_split(s) end
test_csv()
click to toggle source
# File vendor/qwik/lib/qwik/util-csv-tokenizer.rb, line 76 def test_csv # test basic ok(['1'], '1') ok(['1', ''], '1,') ok(['1', '2'], '1,2') ok(['1', '', '3'], '1,,3') # test from plugin ok(['a', 'b'], 'a,b') ok(["'a'", 'b'], "'a',b") ok(['a', 'b'], 'a, b') ok(['a', '', 'b'], 'a,,b') # test space ok(['1'], ' 1') ok(['1'], '1 ') ok(['1', '2'], '1, 2') ok(['1', '2'], "1,\n2") ok(['1', '2'], "1,\t2") ok(['1', '2'], "1,\\2") # test escape ok(["\"1\"\""], '"1""') # test IN_QFIELD ok(["'1'"], "'1'") ok(["'1 '"], "'1 '") ok(["'1,2'"], "'1,2'") ok(["\"1\""], "\"1\"") ok(["\"1\"", "\"2\""], "\"1\",\"2\"") ok(["\"1", "2\""], '"1,2"') # test with space ok(["'a b'"], "'a b'") ok(['a b'], 'a b') end