Is this a wrong test?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Is this a wrong test?

最萌 小汐

testes\utf8.lua: 69

Reply | Threaded
Open this post in threaded view
|

答复: Is this a wrong test?

最萌 小汐

testes\utf8.lua: 69

 

assert(utf8.len(s, 1, pi, -1, nonstrict) == i)

 

Here passed 5 args to utf8.len, but the manual shows it takes only 4.

 

I'm sorry I sent the mail ahead of time due to my misoperation.

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Is this a wrong test?

Dirk Laurie-2
In reply to this post by 最萌 小汐
Op Wo. 3 Apr. 2019 om 10:45 het 最萌 小汐 <[hidden email]> geskryf:
>
> testes\utf8.lua: 69

The line in question is:

assert(utf8.len(s, 1, pi, -1, nonstrict) == i)

The effect is the same as
    assert(utf8.len(s, 1, pi, true) == i)
but perhaps the intended test was
    assert(utf8.len(s, 1, pi, nonstrict) == i)
which is only the same when nonstrict is truey.

Reply | Threaded
Open this post in threaded view
|

Re: Is this a wrong test?

Roberto Ierusalimschy
> > testes\utf8.lua: 69
>
> The line in question is:
>
> assert(utf8.len(s, 1, pi, -1, nonstrict) == i)
>
> The effect is the same as
>     assert(utf8.len(s, 1, pi, true) == i)
> but perhaps the intended test was
>     assert(utf8.len(s, 1, pi, nonstrict) == i)
> which is only the same when nonstrict is truey.

Sure. Thanks to both of you.

-- Roberto