#include "option_types.hh" #include "unit_tests.hh" namespace Kakoune { UnitTest test_option_parsing{[]{ auto check = [](auto&& value, ConstArrayView strs) { auto repr = option_to_strings(value); kak_assert(strs == ConstArrayView{repr}); auto parsed = option_from_strings(Meta::Type>{}, strs); kak_assert(parsed == value); }; check(123, {"123"}); check(true, {"true"}); check(Vector{"foo", "bar:", "baz"}, {"foo", "bar:", "baz"}); check(Vector{10, 20, 30}, {"10", "20", "30"}); check(HashMap{{"foo", 10}, {"b=r", 20}, {"b:z", 30}}, {"foo=10", "b\\=r=20", "b:z=30"}); check(DebugFlags::Keys | DebugFlags::Hooks, {"hooks|keys"}); }}; }