• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Warning: This build has drifted.
The coverage report for this pull request build may be inaccurate because its base commit is no longer the HEAD of its target branch.
This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

    • Learn more: For more information on this, see Tracking coverage changes for pull request builds.
    • Fix now: For a quick fix, rebase this PR at GitHub. Your next report should be accurate.
    • Prevent going forward: To avoid this issue with future PRs, see these Recommended CI Configurations.
New Repo Setting:
INCLUDE COVERAGE % WITH WARNINGS ABOUT DRIFTED BUILDS?

Enabling this setting will include a (potentially inaccurate) coverage % with warning messages in status updates for drifted builds.

Adjust setting

google / go-jsonnet / 13855246391
56%
master: 44%

Build:
Build:
LAST BUILD BRANCH: error-test-for-manifestYamlDoc
DEFAULT BRANCH: master
Ran 21 Mar 2025 04:29PM UTC
Jobs 1
Files 65
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Mar 2025 11:00AM UTC coverage: 55.582% (+0.008%) from 55.574%
13855246391

Pull #797

github

rudo-thomas
fix: Fix error messages when a comprehension iterates over a non-array.

Problems:
 - When iterating over an empty string in a list comprehension, the
   result is an empty string. This is a bug, it should be an error.
 - When iterating over a non-empty string in a list comprehension, the
   expected and unexpected types in the error message are swapped.
 - Error messages mention "std.flatMap" when object/list comprehensions
   would iterate over a value that is neither array nor string.

```
$ jsonnet --version
Jsonnet commandline interpreter (Go implementation) v0.21.0-rc2
$ jsonnet -e '[a for a in ""]'
""
$ jsonnet -e '[a for a in "b"]'
RUNTIME ERROR: Unexpected type array, expected string
	<cmdline>:1:1-17
	During evaluation
$ jsonnet -e '{[a]: 1 for a in 2}'
RUNTIME ERROR: std.flatMap second param must be array / string, got number
	<cmdline>:1:1-20
	<cmdline>:1:1-20
	During evaluation
$ jsonnet -e '[a for a in 1]'
RUNTIME ERROR: std.flatMap second param must be array / string, got number
	<cmdline>:1:1-15
	During evaluation
```

FWIW, the C++ implementation does not have any of these problems. It
gives:
```
RUNTIME ERROR: In comprehension, can only iterate over array.
```

In the Go implementation comprehensions are desugared to a call to
std.flatMap which does accept a string in the "arr" parameter.

The fix: Desugar comprehensions to a call to a new hidden builtin which
only accepts arrays.
Pull Request #797: fix: Fix error messages when a comprehension iterates over a non-array.

7 of 8 new or added lines in 3 files covered. (87.5%)

2 existing lines in 1 file now uncovered.

7558 of 13598 relevant lines covered (55.58%)

185172.92 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
0.0
0.0% internal/program/desugarer.go

Uncovered Existing Lines

Lines Coverage ∆ File
2
80.74
-0.04% builtins.go
Jobs
ID Job ID Ran Files Coverage
1 13855246391.1 21 Mar 2025 04:29PM UTC 65
55.58
GitHub Action Run
Source Files on build 13855246391
  • Tree
  • List 65
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #797
  • PR Base - master (#13824638860)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc