JordanMarr / SqlHydra

SqlHydra is a suite of NuGet packages for working with databases in F# including code generation tools and query expressions.
MIT License
223 stars 22 forks source link

Order columns by ORDINAL_POSITION #12

Closed Jmaharman closed 2 years ago

Jmaharman commented 2 years ago

I wanted to verify the output of the code in a more automated way, so I've added the Verify.Expecto package to the test project and changed "Print Code" to "Generated Code" so we can acceptance test against that.

If you don't want that reference added just let me know and I'll go with the simpler option of making the ordinal position change.

This is an attempted fix for #11

JordanMarr commented 2 years ago

I think that is a terrific use case for Verify.

The only downside I can think of is that the generated output includes a version number at the first line which will cause the verify tests to fail every time the version is incremented. 🤔

@simoncropp

SimonCropp commented 2 years ago

awesome. a couple of points

SimonCropp commented 2 years ago

The only downside I can think of is that the generated output includes a version number at the first line which will cause the verify tests to fail every time the version is incremented

you should be able to fix that with a scrubber. perhaps ScrubLinesWithReplace? https://github.com/VerifyTests/Verify/blob/main/docs/scrubbers.md#scrublineswithreplace

JordanMarr commented 2 years ago

awesome. a couple of points

Thanks. I totally missed the part about excluding .received.txt files from source control, but that makes sense. Scrubbing the data before verifying it is a good idea.

SimonCropp commented 2 years ago

.received.txt files from source control

.received.* since verify can output any format

Jmaharman commented 2 years ago

Cool, I'll try and make those tweaks later today.

JordanMarr commented 2 years ago

Can you also add the same sort to Sqlite while you're in there?

Jmaharman commented 2 years ago

Sorry for the delay, hopefully these complete the loop. Interesting that Sqlite already seemed to be in the expected order, perhaps that is always expected with Sqlite?

JordanMarr commented 2 years ago

This looks great! It will also cut down on some of the verbosity of the unit tests by removing all the printf output.