Autoincrement String

Posted on
  • I think that this must be an inconsistency in Espruino

    a = "1"
    ="1"
    a++
    ="1"
    a++
    ="11"
    a++
    ="111"
    a = "s"
    ="s"
    a++
    ="s"
    a++
    ="s1"
    a++
    ="s11"
    a++
    ="s111"

    I would have expected (and comfirmed using javascript console in chrome) that if the string were a number it would return 1 , 2, 3 otherwise it would return NaN rather than concatenate 1 on the end.

    Is this a bug?

  • Thanks - yes, it looks like a bug to me. Just fixed it - it'll be in 1v60

  • Just out of curiosity - when things like that get fixed, are there any automated tests also being updated so that it's not coming back in the future?

  • In that case, no. Often I do add tests when I fix things like that though - it's just that in this case it was almost a single-line change.

  • Not sure what is regression tests coverage. Personally I avoid upgradeing espruino as much as possible to avoid new issues not seen earlier (introduced due to refactoring or implementing new features). At this level of complexity of code the regression tests are very important.

  • You're welcome to contribute more regression tests if you want. It's as easy as a pull request :)

    I only have so much time, so have to balance writing tests with fixing things and adding features. There's no point having a million tests which all fail.

    I have around 170 tests at the moment, and I don't make a release knowing that any of those have regressed - so as far as language regressions go I can be relatively confident.

    It's a shame you choose not to update - personally I don't think I have introduced many regressions recently? There have definitely been a massive amount of new features and bugfixes though.

  • I probably exaggerated a litle bit when talking about avoiding of upgrading.
    Sorry, no ofense .

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Autoincrement String

Posted by Avatar for arthurj @arthurj

Actions