Permalink
Commits on Apr 17, 2017
  1. Tidy a bunch

    xsawyerx committed Apr 17, 2017
  2. Remove critic warning

    xsawyerx committed Apr 17, 2017
  3. Add /ms to all regular expressions:

    xsawyerx committed Apr 17, 2017
    PBP and /xms defaults for regular expressions.
  4. Use condition with correct precedence:

    xsawyerx committed Apr 17, 2017
    The "||" operator would change the value that will be assigned,
    while we want to check the value that will be assigned, using
    "or".
  5. Add shebang to all tests

    paultcochrane committed Apr 17, 2017
    This separates them from modules which don't have a shebang since they
    aren't scripts.
  6. Uncuddle else and elsif

    paultcochrane committed Apr 17, 2017
  7. Name base test files more correctly

    paultcochrane committed Apr 17, 2017
    Actually, the base tests are simply "base" for that system, so they
    aren't the base tests for unix.  The base tests for Windows are really
    the mocked windows tests, so they should be described as such.  Hence,
    when testing on a Windows system, the base tests will test the actual
    Windows system and the mocked tests will run for fake Windows systems.
  8. Remove dead, incorrect code in if_info()

    paultcochrane committed Apr 17, 2017
    The if_info() should return a hash containing interface names and ip
    addresses in key/value pairs.  Theoretically, if if_info() was called as
    a function, then it would have returned the string of the `ifconfig`
    binary, which is incorrect.  The functional version of if_info() isn't
    exported, hence it couldn't be used anyway, but further than that, if it
    had been used via its functional interface, it would have thrown an
    error, since $self would be a reference and hence the functional code
    would have barfed.  An inspection of the code showed that this code path
    was never taken, hence the offending code could simply be removed.
  9. Add more tests of functional interface

    paultcochrane committed Apr 17, 2017
    ... namely the ips() and interfaces() functions.  It's a good idea to
    check that the functional interface returns the same output as the OO
    interface.
  10. Turn magic numbers into variables

    paultcochrane committed Apr 17, 2017
    ... with names to describe their purpose.  It turns out that the number
    of Windows mocking checks is coupled to the number of calls to
    base_tests() since the redefinition of the _run_ipconfig() function
    contains a call to ok(), hence any change to the base_tests() that
    implicitly requires a change to the number of calls to _run_ipconfig()
    will result in different number of tests in the plan.
  11. Prefix all test files with numbers

    paultcochrane committed Apr 17, 2017
    This makes sure that the more important tests are run first.
  12. Fix plan in ipconfig tests

    paultcochrane committed Apr 17, 2017
    There's a test implicitly happening within mock_win32_hostip() which
    meant that three tests were being run for each call to the wrapper test
    function instead of two.
  13. Turning of execution flag

    xsawyerx committed Apr 17, 2017
  14. Improve Windows handling:

    xsawyerx committed Apr 17, 2017
    Windows can only be detected once. There's no reason to continuously
    run code to determine it. We now have a global variable $IS_WIN that
    is decided during compilation.
    
    The tests now have been split to two: The Unix and the Windows. The
    Windows ones now also mock Windows using $IS_WIN, and also verify that
    they're retrieving the mocked results.
Commits on Apr 16, 2017
  1. Use statements

    xsawyerx committed Apr 16, 2017
  2. No need for this to be a method

    xsawyerx committed Apr 16, 2017
  3. Modules should end with 1;

    xsawyerx committed Apr 16, 2017
  4. Move MockUtils to t::lib

    xsawyerx committed Apr 16, 2017
Commits on Apr 15, 2017
  1. Rename mock_and_test -> test_mock_ipconfig

    paultcochrane committed Apr 15, 2017
    ... which I think is a clearer name for what the sub does.
  2. Replace _run_ipconfig replacement with mock_win32_hostip()

    paultcochrane committed Apr 15, 2017
    The new function runs _run_ipconfig() internally and returns an
    appropriate hostip object.  This change removes more repeated code.
  3. Move mock_run_ipconfig into central mocking utils module

    paultcochrane committed Apr 15, 2017
    In order to remove code duplication, this change creates the
    `Sys::HostIP::MockUtils` module so that the test mocking code can be
    shared between test files.
  4. Run base tests across mocked Windows interfaces

    paultcochrane committed Apr 15, 2017
    Now we also check that the base tests work on more systems.  This change
    has also helped to bump the test coverage up over 80%.
  5. Extract base tests out into their own sub

    paultcochrane committed Apr 15, 2017
    This isolates the tests to run even futher, and by giving the sub a
    name, we can try to be clear as to our intention as to what is being
    run.
  6. Wrap base tests in a main() function

    paultcochrane committed Apr 15, 2017
    The plan is to run the base tests over a variety of interface
    configurations (mocked and real), hence we need to isolate the tests
    that are actually being run.  This change is one step along that path.
Commits on Apr 14, 2017
  1. Convert is_win var into a method

    paultcochrane committed Apr 14, 2017
    ... this makes it easier to mock Windows tests on Linux systems.