测试:完善和优化测试用例

- 优化 schema 测试用例,增加边界条件测试
- 完善 table、index、database 等模块的测试
- 改进测试数据清理和错误处理
- 更新示例程序以使用最新 API
- 增强测试覆盖率和可靠性
This commit is contained in:
2025-10-09 21:47:14 +08:00
parent 89af9e9259
commit 6d04487789
14 changed files with 812 additions and 132 deletions

View File

@@ -80,7 +80,10 @@ func OpenTable(opts *TableOptions) (*Table, error) {
var sch *Schema
if opts.Name != "" && len(opts.Fields) > 0 {
// 从 Name 和 Fields 创建 Schema
sch = NewSchema(opts.Name, opts.Fields)
sch, err = NewSchema(opts.Name, opts.Fields)
if err != nil {
return nil, fmt.Errorf("create schema: %w", err)
}
// 保存到磁盘(带校验和)
schemaPath := filepath.Join(opts.Dir, "schema.json")
schemaFile, err := NewSchemaFile(sch)