Version 0.2.0: RDB_ICASE, Changelog, --version, angepasste Man-Pages

This commit is contained in:
wkh
2026-10-11 21:24:11 +02:00
parent b5b28798ac
commit 8f6dc852ff
18 changed files with 259 additions and 4 deletions
+37
View File
@@ -478,4 +478,41 @@ class ActTest < RdbCase
assert_includes out, 'Duplicate Short names in chart'
assert st.success?, err
end
ICASE = { 'RDB_ICASE' => '1' }.freeze
def test_column_names_are_case_sensitive_by_default
_o, err, st = run3('column', 'cost', stdin: File.read(File.join(@dir, 'inventory')))
assert st.success?, err
assert_equal %w[cost], _o.lines.first.chomp.split("\t")
end
def test_icase_column_and_sorttable
out, err, st = run3('column', 'COST', 'item', stdin: File.read(File.join(@dir, 'inventory')), env: ICASE)
assert st.success?, err
assert_equal %w[Cost Item], out.lines.first.chomp.split("\t")
out, = run3('sorttable', '-nr', 'cost', stdin: File.read(File.join(@dir, 'inventory')), env: ICASE)
assert_equal 'scales', data(out).first.last
end
def test_icase_compute_and_awk_words
src = File.read(File.join(@dir, 'inventory'))
out, err, st = run3('compute', 'value = sprintf("%5.2f", cost * AMOUNT)', stdin: src, env: ICASE)
assert st.success?, err
assert_equal '1312.75', data(out)[5][3].strip
# a column called Length must not swallow the length() function
t = "Length\tName\n------\t----\n3\tab\n"
out, err, st = run3('compute', 'Length = length(name)', stdin: t, env: ICASE)
assert st.success?, err
assert_equal [%w[2 ab]], data(out)
end
def test_icase_ambiguous_column_is_an_error
t = "Name\tname\n----\t----\na\tb\n"
_o, err, st = run3('column', 'NAME', stdin: t, env: ICASE)
refute st.success?
assert_match(/ambiguous/, err)
out, = run3('column', 'name', stdin: t, env: ICASE)
assert_equal [%w[b]], data(out)
end
end