|
7 | 7 | -export([all/0]). |
8 | 8 | -export([get_module_attributes/1, |
9 | 9 | get_module_configuration/1, |
| 10 | + description_binary_and_list/1, |
10 | 11 | errors_reporting/1, |
11 | 12 | one_of_function/1]). |
12 | 13 |
|
@@ -52,6 +53,7 @@ update_value(_, _) -> ok. |
52 | 53 | all() -> |
53 | 54 | [get_module_attributes, |
54 | 55 | get_module_configuration, |
| 56 | + description_binary_and_list, |
55 | 57 | errors_reporting, |
56 | 58 | one_of_function]. |
57 | 59 |
|
@@ -109,6 +111,27 @@ get_module_configuration(_) -> |
109 | 111 | verification_fn = VerificationNone, update_fn = UpdateValueFN}], |
110 | 112 | Config). |
111 | 113 |
|
| 114 | +description_binary_and_list(_) -> |
| 115 | + %% Description as list (string) is accepted and stored as binary |
| 116 | + ListAttr = #{name => desc_list_var, description => "list description", |
| 117 | + default_value => def, verification => none, update => read_only}, |
| 118 | + {ok, [#module_parameter{description = <<"list description">>}]} = |
| 119 | + amoc_config_attributes:process_module_attributes(?MODULE, [ListAttr]), |
| 120 | + %% Description as binary is accepted and stored as binary |
| 121 | + BinAttr = #{name => desc_bin_var, description => <<"binary description">>, |
| 122 | + default_value => def, verification => none, update => read_only}, |
| 123 | + {ok, [#module_parameter{description = <<"binary description">>}]} = |
| 124 | + amoc_config_attributes:process_module_attributes(?MODULE, [BinAttr]), |
| 125 | + %% Unicode in both forms is preserved |
| 126 | + UnicodeList = #{name => unicode_list_var, description => "café", |
| 127 | + default_value => def, verification => none, update => read_only}, |
| 128 | + {ok, [#module_parameter{description = <<"café"/utf8>>}]} = |
| 129 | + amoc_config_attributes:process_module_attributes(?MODULE, [UnicodeList]), |
| 130 | + UnicodeBin = #{name => unicode_bin_var, description => <<"café"/utf8>>, |
| 131 | + default_value => def, verification => none, update => read_only}, |
| 132 | + {ok, [#module_parameter{description = <<"café"/utf8>>}]} = |
| 133 | + amoc_config_attributes:process_module_attributes(?MODULE, [UnicodeBin]). |
| 134 | + |
112 | 135 | errors_reporting(_) -> |
113 | 136 | InvalidParam0 = #{name => "invalid_var0", description => "config_attrs_var0"}, |
114 | 137 | InvalidParam1 = #{name => invalid_var1, description => [$a, -2]}, |
|
0 commit comments