test: Check setting nsort=0 option is respected

pull/54/head
David Drysdale 9 years ago
parent 5bbb7538bb
commit 670a38e19d
  1. 20
      test/ares-test-init.cc

@ -354,6 +354,26 @@ CONTAINED_TEST_F(LibraryTest, ContainerChannelInit,
return HasFailure();
}
CONTAINED_TEST_F(LibraryTest, ContainerSortlistOptionInit,
"myhostname", "mydomainname.org", filelist) {
ares_channel channel = nullptr;
struct ares_options opts = {0};
int optmask = 0;
optmask |= ARES_OPT_SORTLIST;
opts.nsort = 0;
// Explicitly specifying an empty sortlist in the options should override the
// environment.
EXPECT_EQ(ARES_SUCCESS, ares_init_options(&channel, &opts, optmask));
ares_save_options(channel, &opts, &optmask);
EXPECT_EQ(0, opts.nsort);
EXPECT_EQ(nullptr, opts.sortlist);
EXPECT_EQ(ARES_OPT_SORTLIST, (optmask & ARES_OPT_SORTLIST));
ares_destroy_options(&opts);
ares_destroy(channel);
return HasFailure();
}
NameContentList fullresolv = {
{"/etc/resolv.conf", " nameserver 1.2.3.4 \n"
"search first.com second.com\n"

Loading…
Cancel
Save