Skip to content

Commit

Permalink
coverage: fix loaded function name
Browse files Browse the repository at this point in the history
Now we load flatten functions for spaces with `@flatten` source. Source
starting with @ assumes that it describes the file name, yet here it
isn't. Then luacov fails to find "flatten" file on coverage info build.

When we do not specify source explicitly, the whole string becames the
source. It will not confuse luacov anymore (it just ignores them), and
it's more helpful for debug.

1. https://www.lua.org/manual/5.2/manual.html#pdf-load

Closes #249
  • Loading branch information
DifferentialOrange committed Mar 24, 2023
1 parent b5e2b27 commit c0ef1f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
* Yield on select/pairs storage tuple lookup (#312).

### Fixed
* Loaded functions misleading coverage (#249).

## [1.1.0] - 13-03-23

### Added
Expand Down
2 changes: 1 addition & 1 deletion crud/common/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function utils.flatten(object, space_format, bucket_id, skip_nullability_check)
fieldmap = fieldmap,
NULL = box.NULL,
}
flatten_func = assert(load(code, '@flatten', 't', env))
flatten_func = assert(load(code, nil, 't', env))

flatten_functions_cache[space_format] = flatten_func
local data, err = flatten_func(object, bucket_id, skip_nullability_check)
Expand Down

0 comments on commit c0ef1f6

Please sign in to comment.