Skip to content

Commit

Permalink
improve conf node
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Feb 26, 2025
1 parent 91821cb commit 8680ac8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# 最新动态
2025/02/26
* 修复conf_node的node_type不正确的问题(感谢福明提供补丁)

2025/02/22
* 完善状态同步到子控件的功能(感谢兆坤提供补丁)
Expand Down
2 changes: 1 addition & 1 deletion src/conf_io/conf_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ struct _conf_node_t {
* @property {conf_node_type_t} node_type
* 节点类型。
*/
conf_node_type_t node_type : 3;
conf_node_type_t node_type : 4;

/*private*/
bool_t is_small_name : 1;
Expand Down
5 changes: 5 additions & 0 deletions tests/conf_node_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ TEST(ConfNode, set_get_str) {
ASSERT_EQ(conf_doc_set(doc, "names.[1]", value_set_str(&v, "tom")), RET_OK);
ASSERT_EQ(conf_doc_set(doc, "names.[2]", value_set_str(&v, "anny")), RET_OK);

conf_node_t* node;
node = conf_doc_find_node(doc, doc->root, "names.[0]", FALSE);
ASSERT_TRUE(node != NULL);
ASSERT_EQ(node->node_type, CONF_NODE_SIMPLE);

ASSERT_EQ(conf_doc_save_json(doc, &str), RET_OK);
ASSERT_STREQ(
str.str,
Expand Down

0 comments on commit 8680ac8

Please sign in to comment.