Sha256: 489e59c11e9d22938539b4d18df02a75fb6cc8dcdf1981cf30956fde9bf4a2df

Contents?: true

Size: 593 Bytes

Versions: 16

Compression:

Stored size: 593 Bytes

Contents

#include <catch.hpp>
#include <internal/util/posix/scoped_descriptor.hpp>
#include <sys/socket.h>
#include <fcntl.h>

using namespace std;
using namespace facter::util::posix;

SCENARIO("constructing a POSIX scoped descriptor") {

    int sock = socket(AF_INET, SOCK_DGRAM, 0);

    {
        scoped_descriptor scoped(sock);
    }

    // This check could theoretically fail if the OS reassigns the file
    // descriptor between the above destructor call and this line
    // This likely will not happen during testing.
    REQUIRE(fcntl(sock, F_GETFD) == -1);
    REQUIRE(errno == EBADF);
}

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.12.1.cfacter.20181031 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.11.6.cfacter.20181031 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.12.1.cfacter.20181023 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.11.5.cfacter.20181022 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.12.0.cfacter.20181004 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.12.0.cfacter.20181001 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.12.0.cfacter.20180918 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.11.4.cfacter.20180821 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.11.3.cfacter.20180716 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.11.2.cfacter.20180612 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.9.6.cfacter.20180612 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.11.2.cfacter.20180606 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.9.6.cfacter.20180606 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
facter-3.11.0.cfacter.20180319 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc
cfacter-3.11.0.rc.20180314 ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc