Skip to content

Commit

Permalink
Merge pull request #295 from cwarden/error-invalid-column
Browse files Browse the repository at this point in the history
Error When Using Invalid Column With add-col!
  • Loading branch information
refaktor authored Aug 2, 2024
2 parents e6686b7 + 46e7916 commit aa62ed9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion evaldo/builtins_spreadsheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ func GenerateColumn(ps *env.ProgramState, s env.Spreadsheet, name env.Word, extr
}
// fmt.Println(val)
if er != nil {
return nil
return MakeBuiltinError(ps, er.Error(), "add-col!")
}
if firstVal == nil {
var ok bool
Expand Down
7 changes: 7 additions & 0 deletions tests/structures.rye
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,13 @@ section "Spreadsheet related functions"
equal { to-spreadsheet vals { dict { "a" 1 b 2 "c" 3 } dict { "a" 4 "b" 5 } } } spreadsheet { "a" "b" "c" } { 1 2 3 4 5 _ }
}

group "add-col"
mold\nowrap ?add-col!
{ { block } }
{
equal { try { spreadsheet { "n" } [ 1 ] |add-col! 'm { x } { x } } |type? } 'error
}

group "index"
mold\nowrap ?add-indexes!
{ { block } }
Expand Down

0 comments on commit aa62ed9

Please sign in to comment.