Closed thefasquelle closed 6 months ago
Hi there,
Thanks for logging the issues. The pretty print issue is something I had ran into too, but had totally forgot about. These issues are now fixed in the latest version.
This leave me wondering: is it safe for me to use this class? Has it been thoroughly tested?
Depends what you mean. We've been using this in a number of our business projects, but the reality is we have only tested the things we use regularly - parsing, creation and non-pretty stringification - which are really the only 3 things which are mission critical also. Pretty printing was always added as a nice-to-have for debugging purposes.
I have not exhaustively tested everything, if you want to add unit tests, happy to accept a PR.
It should be noted that at present tests are ran infrequently as is. That said, compare this to your average VBA project... It's generally rare VBA projects are tested just because their are few testing tools, especially because they require the VBE.
Hello, looking for a JSON module to handle JSON config files, I tested your stdJSON class. The first thing i did was trying the example at the top of the file, with just one additional line to write to a file. It didn't work, so I digged into the code and added Option Explicit. Then VBE and rubberduck pointed the following issues :
In ToFile():
Data is not defined. With Option Explicit it will fail at runtime. Without Option Explicit, it juste saves an empty file. I replaced it with
Print #ff, Me.ToString(prettyIndent <> 0, prettyIndent)
In simpleStringify():
vbFloat is undefined, I guess you meant vbSingle ? There is no impact at runtime because the Case Else code works for Singles ... except if the computer locale does not use a dot for the decimal separator. So I suggest you replace this:
with this
Also the example snippet is not functional because of the .obj and .toVBON() methods are not implemented (I suppose toVBON is actually ToVBObject ?)
And lastly, the pretty indent function seems broken, here is the result I got from the example snippet:
This leave me wondering: is it safe for me to use this class ? Has it been thoroughly tested ? The ToFile() method at least has not. I wanted to use this class because its API is pretty nice and the code is not too big but these issues show a lack of testing.