dictu-lang / Dictu

Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language.
https://dictu-lang.com
MIT License
267 stars 53 forks source link

[BUG] Test for String.find falsely passes #748

Closed liz3 closed 2 weeks ago

liz3 commented 2 months ago

Is there an existing issue for this?

Current Behavior

This testcase:

this.assertEquals("Dictu is great! Dictu is great! Dictu is great!".find("Dictu", 3), 37);

Passes in the current builds.

Expected Behavior

I was a bit confused because this test failed over and over in my current endavours of hacking on utf8 support, until i looked somewhat closer at the test:

this.assertEquals("Dictu is great! Dictu is great! Dictu is great!".find("Dictu", 3), 37);

The third occurance of Dictu is at index 32, not at 37= index + search length! So this seams to be a bug? in the current implementation of find?

Steps To Reproduce

Run the string tests for find: dictu tests/strings/find.du

Anything else?

Current test reference: https://github.com/dictu-lang/Dictu/blob/develop/tests/strings/find.du#L24

liz3 commented 1 month ago

@Jason2605 I wanted to bump this

Jason2605 commented 3 weeks ago

Sorry somehow missed this (emails get buried sometimes, need to be more vigilant checking this repo, apologies). Oh wow, that's really bad from me, yeah this is an issue

Jason2605 commented 2 weeks ago

Fixed as part of #749