Sha256: 8812b974c9852c02646829a1b7ad57b89ed3650f23842b88b13f5f8f6a14890b

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

//
//  Copyright (c) 2012 Artyom Beilis (Tonkikh)
//
//  Distributed under the Boost Software License, Version 1.0. (See
//  accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//

#include <boost/nowide/cenv.hpp>
#include <iostream>
#include "test.hpp"

#if defined(BOOST_NOWIDE_TEST_INCLUDE_WINDOWS) && defined(BOOST_WINDOWS)
#include <windows.h>
#endif

#ifdef BOOST_MSVC
#  pragma warning(disable : 4996)
#endif


int main()
{
    try {
        std::string example = "\xd7\xa9-\xd0\xbc-\xce\xbd";
        char penv[256] = {0};
        strncpy(penv,("BOOST_TEST2=" + example + "x").c_str(),sizeof(penv)-1);
        
        TEST(boost::nowide::setenv("BOOST_TEST1",example.c_str(),1)==0);
        TEST(boost::nowide::getenv("BOOST_TEST1"));
        TEST(boost::nowide::getenv("BOOST_TEST1")==example);
        TEST(boost::nowide::setenv("BOOST_TEST1","xx",0)==0);
        TEST(boost::nowide::getenv("BOOST_TEST1")==example);
        TEST(boost::nowide::putenv(penv)==0);
        TEST(boost::nowide::getenv("BOOST_TEST2"));
        TEST(boost::nowide::getenv("BOOST_TEST_INVALID")==0);
        TEST(boost::nowide::getenv("BOOST_TEST2")==example + "x");
        
        std::cout << "Ok" << std::endl;
        return 0;
    }
    catch(std::exception const &e) {
        std::cerr << "Failed " << e.what() << std::endl;
        return 1;
    }
}

///
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.12.1.cfacter.20181031 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.11.6.cfacter.20181031 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.12.1.cfacter.20181023 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.11.5.cfacter.20181022 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.12.0.cfacter.20181004 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.12.0.cfacter.20181001 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.12.0.cfacter.20180918 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.11.4.cfacter.20180821 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.11.3.cfacter.20180716 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.11.2.cfacter.20180612 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.9.6.cfacter.20180612 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.11.2.cfacter.20180606 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.9.6.cfacter.20180606 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
facter-3.11.0.cfacter.20180319 ext/facter/leatherman/vendor/nowide/test/test_env.cpp
cfacter-3.11.0.rc.20180314 ext/facter/leatherman/vendor/nowide/test/test_env.cpp