#'error unable to resolve comptime value' inside test

1 messages · Page 1 of 1 (latest)

faint venture
#

I'm not really sure what I've done wrong, I've written a few tests before but this error is new to me.
code: https://zigbin.io/41da90

#
error: unable to resolve comptime value
    try expectEqual(1, result.len);
                       ~~~~~~^~~~
note: argument to parameter with comptime only type must be comptime known
#

(forgot to post actual error, my bad)

verbal heath
#

Issue is that the first argument is a comptime_int, and the second argument has a type @TypeOf(expected)

#

So you're trying to pass a runtime value to a comptime only argument

#

Fix would be to make the first argument be @as(usize, 1)

faint venture
#

genius, thanks

#

and then u1 for the others

#

gotcha, thanks

verbal heath
#

Np. There is an issue open for this btw

faint venture
#

oh, is this behavior going to change?

verbal heath
#

It might change

#

Nothing is set in stone

#

But just a heads up is all

faint venture
#

alright, good to know

rare isle
#

@verbal heath sorry to bump this, but I ran into this. could you link the github issue?