jackpal / gateway

A golang library for discovering the address of a LAN gateway.
BSD 3-Clause "New" or "Revised" License
226 stars 69 forks source link

Refactor out parsing code, simplify execution, improve testing #10

Closed calmh closed 8 years ago

calmh commented 8 years ago

This moves all of the parsing code to common and adds some tests to them. The diff is quite ugly but the end result is that the platform specific functions are essentially all just wrappers around CombinedOutput + calling the parser, and the parsers all live in the common file for easier testing.

The test code isn't particularly beautiful due to the large static strings being declared, but that's what it is. The naming of stuff can surely be nitpicked, I've gone with parse$platform$method mostly to keep it somewhat unambiguous...