diff options
author | Vincent Ambo <mail@tazj.in> | 2022-05-18T15·39+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-05-19T14·08+0000 |
commit | d127f9bd0e7b9b2e0df2de8a2227f77c0907468d (patch) | |
tree | 68455040d88b8e0c2817601db88ede450873ff8e /third_party/nix/src/tests | |
parent | c85291c602ac666421627d6934ebc6d5be1b93e1 (diff) |
chore(3p/nix): unvendor tvix 0.1 r/4098
Nothing is using this now, and we'll likely never pick this up again, but we learned a lot in the process. Every now and then this breaks in some bizarre way on channel bumps and it's just a waste of time to maintain that. Change-Id: Idcf2f5acd4ca7070ce18d7149cbfc0d967dc0a44 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5632 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: lukegb <lukegb@tvl.fyi> Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'third_party/nix/src/tests')
250 files changed, 0 insertions, 3325 deletions
diff --git a/third_party/nix/src/tests/CMakeLists.txt b/third_party/nix/src/tests/CMakeLists.txt deleted file mode 100644 index f8158d06c306..000000000000 --- a/third_party/nix/src/tests/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -# -*- mode: cmake; -*- -include_directories(${PROJECT_BINARY_DIR}) # for 'generated/' - -add_executable(attr-set attr-set.cc) -target_link_libraries(attr-set - nixexpr - rapidcheck - rapidcheck_gtest - GTest::gtest_main -) - -gtest_discover_tests(attr-set) - -add_executable(derivations_test derivations_test.cc) -target_link_libraries(derivations_test - nixexpr - nixstore - rapidcheck - rapidcheck_gtest - GTest::gtest_main -) - -gtest_discover_tests(derivations_test) - -add_executable(hash_test hash_test.cc) -target_link_libraries(hash_test - nixutil - GTest::gtest_main -) - -gtest_discover_tests(hash_test) - -add_executable(references_test references_test.cc) -target_link_libraries(references_test - nixstore - rapidcheck - rapidcheck_gtest - GTest::gtest_main -) - -gtest_discover_tests(references_test) - -add_executable(store_test store_tests.cc) -target_link_libraries(store_test - nixstore - nixstoremock - GTest::gtest_main -) - -gtest_discover_tests(store_test) - -add_executable(value-to-json value-to-json.cc) -target_link_libraries(value-to-json - nixexpr - nixstore - GTest::gtest_main -) - -gtest_discover_tests(value-to-json) - -add_executable(language-tests language-tests.cc) -target_link_libraries(language-tests - nixexpr - nixstore - GTest::gtest_main -) - -gtest_discover_tests(language-tests) - -add_executable(store-api-test store-api-test.cc) -target_link_libraries(store-api-test - nixstore - rapidcheck - rapidcheck_gtest - GTest::gtest_main -) - -gtest_discover_tests(store-api-test) diff --git a/third_party/nix/src/tests/arbitrary.hh b/third_party/nix/src/tests/arbitrary.hh deleted file mode 100644 index 026f8522cf71..000000000000 --- a/third_party/nix/src/tests/arbitrary.hh +++ /dev/null @@ -1,176 +0,0 @@ -#pragma once - -#include <rapidcheck.h> -#include <rapidcheck/Gen.h> -#include <rapidcheck/gen/Arbitrary.h> - -#include "libexpr/attr-set.hh" -#include "libexpr/nixexpr.hh" -#include "libstore/derivations.hh" -#include "libutil/hash.hh" - -namespace nix::tests { -static nix::SymbolTable* symbol_table; -} - -namespace rc { - -using nix::Derivation; -using nix::DerivationOutput; -using nix::Pos; -using nix::Value; - -template <> -struct Arbitrary<nix::Symbol> { - static Gen<nix::Symbol> arbitrary() { - return gen::map(gen::arbitrary<std::string>(), [](std::string s) { - return nix::tests::symbol_table->Create(s); - }); - } -}; - -template <> -struct Arbitrary<Value> { - static Gen<nix::Value> arbitrary() { - return gen::build(gen::construct<Value>(), - // TODO(grfn) generalize to more types - gen::set(&Value::type, gen::just(nix::ValueType::tInt)), - gen::set(&Value::integer, gen::arbitrary<int64_t>())); - } -}; - -template <> -struct Arbitrary<Value*> { - static Gen<nix::Value*> arbitrary() { - return gen::apply( - [](nix::ValueType typ, int i) { - auto ret = new Value(); - ret->type = typ; - ret->integer = i; - return ret; - }, - gen::just(nix::ValueType::tInt), gen::arbitrary<int64_t>()); - } -}; - -template <> -struct Arbitrary<nix::Pos> { - static Gen<nix::Pos> arbitrary() { - return gen::construct<nix::Pos>(gen::arbitrary<nix::Symbol>(), - gen::arbitrary<unsigned int>(), - gen::arbitrary<unsigned int>()); - } -}; - -template <> -struct Arbitrary<nix::Pos*> { - static Gen<nix::Pos*> arbitrary() { - return gen::apply( - [](unsigned int line, unsigned int column) { - return new Pos({}, line, column); - }, - gen::arbitrary<unsigned int>(), gen::arbitrary<unsigned int>()); - } -}; - -template <> -struct Arbitrary<nix::Attr> { - static Gen<nix::Attr> arbitrary() { - return gen::construct<nix::Attr>(gen::arbitrary<nix::Symbol>(), - gen::arbitrary<Value*>(), - gen::arbitrary<nix::Pos*>()); - } -}; - -template <> -struct Arbitrary<nix::Bindings> { - static Gen<nix::Bindings> arbitrary() { - return gen::map(gen::arbitrary<std::vector<nix::Attr>>(), [](auto attrs) { - nix::Bindings res; - for (const auto& attr : attrs) { - res.push_back(attr); - } - return res; - }); - } -}; - -template <class K, class V> -struct Arbitrary<absl::btree_map<K, V>> { - static Gen<absl::btree_map<K, V>> arbitrary() { - return gen::map(gen::arbitrary<std::map<K, V>>(), [](std::map<K, V> map) { - absl::btree_map<K, V> out_map; - out_map.insert(map.begin(), map.end()); - return out_map; - }); - } -}; - -template <> -struct Arbitrary<nix::Base> { - static Gen<nix::Base> arbitrary() { - return gen::element(nix::Base16, nix::Base32, nix::Base64); - } -}; - -template <> -struct Arbitrary<DerivationOutput> { - static Gen<DerivationOutput> arbitrary() { - return gen::apply( - [](std::string content, std::string path, std::string hash_algo, - bool recursive, bool include_algo_in_hash, nix::Base base) { - auto hash_type = nix::parseHashType(hash_algo); - auto hash = nix::hashString(hash_type, content); - return DerivationOutput( - path, recursive ? absl::StrCat("r:", hash_algo) : hash_algo, - hash.to_string(base, include_algo_in_hash)); - }, - gen::arbitrary<std::string>(), - gen::map(gen::arbitrary<std::string>(), - [](std::string s) { return absl::StrCat("/", s); }), - gen::element<std::string>("md5", "sha1", "sha256", "sha512"), - gen::arbitrary<bool>(), gen::arbitrary<bool>(), - gen::arbitrary<nix::Base>()); - } -}; - -template <> -struct Arbitrary<Derivation> { - static Gen<Derivation> arbitrary() { - auto gen_path = gen::map(gen::arbitrary<std::string>(), [](std::string s) { - return absl::StrCat("/", s); - }); - - return gen::build<Derivation>( - gen::set(&nix::BasicDerivation::outputs), - gen::set(&nix::BasicDerivation::inputSrcs, - gen::container<nix::PathSet>(gen_path)), - gen::set(&nix::BasicDerivation::platform), - gen::set(&nix::BasicDerivation::builder, gen_path), - gen::set(&nix::BasicDerivation::args), - gen::set(&nix::BasicDerivation::env), - gen::set(&Derivation::inputDrvs, - gen::container<nix::DerivationInputs>( - gen_path, gen::arbitrary<nix::StringSet>()))); - } -}; - -template <> -struct Arbitrary<nix::BuildResult::Status> { - static Gen<nix::BuildResult::Status> arbitrary() { - return gen::element(nix::BuildResult::Status::Built, - nix::BuildResult::Status::Substituted, - nix::BuildResult::Status::AlreadyValid, - nix::BuildResult::Status::PermanentFailure, - nix::BuildResult::Status::InputRejected, - nix::BuildResult::Status::OutputRejected, - nix::BuildResult::Status::TransientFailure, - nix::BuildResult::Status::CachedFailure, - nix::BuildResult::Status::TimedOut, - nix::BuildResult::Status::MiscFailure, - nix::BuildResult::Status::DependencyFailed, - nix::BuildResult::Status::LogLimitExceeded, - nix::BuildResult::Status::NotDeterministic); - } -}; -} // namespace rc diff --git a/third_party/nix/src/tests/attr-set.cc b/third_party/nix/src/tests/attr-set.cc deleted file mode 100644 index 35932bbeff65..000000000000 --- a/third_party/nix/src/tests/attr-set.cc +++ /dev/null @@ -1,71 +0,0 @@ -#include "libexpr/attr-set.hh" - -#include <cstdio> -#include <optional> -#include <string> -#include <vector> - -#include <absl/container/btree_map.h> -#include <bits/stdint-intn.h> -#include <gtest/gtest.h> -#include <rapidcheck.h> -#include <rapidcheck/Assertions.h> -#include <rapidcheck/gen/Arbitrary.h> -#include <rapidcheck/gen/Build.h> -#include <rapidcheck/gen/Create.h> -#include <rapidcheck/gen/Transform.h> -#include <rapidcheck/gtest.h> - -#include "libexpr/eval.hh" -#include "libexpr/nixexpr.hh" -#include "libexpr/symbol-table.hh" -#include "libexpr/value.hh" -#include "tests/arbitrary.hh" -#include "tests/dummy-store.hh" - -namespace nix { - -using nix::tests::DummyStore; - -class AttrSetTest : public ::testing::Test { - protected: - EvalState* eval_state_; - void SetUp() override { - nix::expr::InitGC(); - auto store = std::make_shared<DummyStore>(); - eval_state_ = new EvalState({"."}, ref<Store>(store)); - tests::symbol_table = &eval_state_->symbols; - } - - void assert_bindings_equal(nix::Bindings* lhs, nix::Bindings* rhs) { - RC_ASSERT(lhs->Equal(rhs, *eval_state_)); - } -}; - -class AttrSetMonoidTest : public AttrSetTest {}; - -RC_GTEST_FIXTURE_PROP(AttrSetMonoidTest, mergeLeftIdentity, - (nix::Bindings && bindings)) { - auto empty_bindings = nix::Bindings::New(); - auto result = Bindings::Merge(*empty_bindings, bindings); - assert_bindings_equal(result.get(), &bindings); -} - -RC_GTEST_FIXTURE_PROP(AttrSetMonoidTest, mergeRightIdentity, - (nix::Bindings && bindings)) { - auto empty_bindings = nix::Bindings::New(); - auto result = Bindings::Merge(bindings, *empty_bindings); - assert_bindings_equal(result.get(), &bindings); -} - -RC_GTEST_FIXTURE_PROP(AttrSetMonoidTest, mergeAssociative, - (nix::Bindings && bindings_1, nix::Bindings&& bindings_2, - nix::Bindings&& bindings_3)) { - auto b231 = - Bindings::Merge(bindings_1, *Bindings::Merge(bindings_2, bindings_3)); - auto b123 = - Bindings::Merge(*Bindings::Merge(bindings_1, bindings_2), bindings_3); - assert_bindings_equal(b231.get(), b123.get()); -} - -} // namespace nix diff --git a/third_party/nix/src/tests/derivations_test.cc b/third_party/nix/src/tests/derivations_test.cc deleted file mode 100644 index 6ebe17824ce1..000000000000 --- a/third_party/nix/src/tests/derivations_test.cc +++ /dev/null @@ -1,109 +0,0 @@ -#include "libstore/derivations.hh" - -#include <memory> - -#include <absl/strings/str_cat.h> -#include <gtest/gtest.h> -#include <rapidcheck.h> -#include <rapidcheck/Assertions.h> -#include <rapidcheck/gen/Arbitrary.h> -#include <rapidcheck/gen/Build.h> -#include <rapidcheck/gen/Container.h> -#include <rapidcheck/gen/Tuple.h> -#include <rapidcheck/gtest.h> -#include <rapidcheck/state.h> - -#include "libexpr/eval.hh" -#include "libutil/hash.hh" -#include "libutil/types.hh" -#include "tests/arbitrary.hh" - -namespace nix { - -void AssertDerivationsEqual(const Derivation& lhs, const Derivation& rhs) { - RC_ASSERT(lhs.outputs.size() == rhs.outputs.size()); - for (const auto& [k, lhs_v] : lhs.outputs) { - auto rhs_v = rhs.outputs.find(k); - RC_ASSERT(rhs_v != rhs.outputs.end()); - RC_ASSERT(lhs_v.path == rhs_v->second.path); - RC_ASSERT(lhs_v.hashAlgo == rhs_v->second.hashAlgo); - RC_ASSERT(lhs_v.hash == rhs_v->second.hash); - } - - RC_ASSERT(lhs.inputSrcs == rhs.inputSrcs); - RC_ASSERT(lhs.platform == rhs.platform); - RC_ASSERT(lhs.builder == rhs.builder); - RC_ASSERT(lhs.args == rhs.args); - RC_ASSERT(lhs.env == rhs.env); - RC_ASSERT(lhs.inputDrvs == rhs.inputDrvs); -} - -class DerivationsTest : public ::testing::Test {}; - -// NOLINTNEXTLINE -RC_GTEST_FIXTURE_PROP(DerivationsTest, UnparseParseRoundTrip, - (Derivation && drv)) { - auto unparsed = drv.unparse(); - auto parsed = parseDerivation(unparsed); - AssertDerivationsEqual(drv, parsed); -} - -// NOLINTNEXTLINE -RC_GTEST_FIXTURE_PROP(DerivationsTest, ToProtoPreservesInput, - (Derivation && drv)) { - auto proto = drv.to_proto(); - - RC_ASSERT(proto.outputs_size() == drv.outputs.size()); - RC_ASSERT(proto.input_sources().paths_size() == drv.inputSrcs.size()); - auto paths = proto.input_sources().paths(); - for (const auto& input_src : drv.inputSrcs) { - RC_ASSERT(std::find(paths.begin(), paths.end(), input_src) != paths.end()); - } - - RC_ASSERT(proto.platform() == drv.platform); - RC_ASSERT(proto.builder().path() == drv.builder); - - RC_ASSERT(proto.args_size() == drv.args.size()); - auto args = proto.args(); - for (const auto& arg : drv.args) { - RC_ASSERT(std::find(args.begin(), args.end(), arg) != args.end()); - } - - RC_ASSERT(proto.env_size() == drv.env.size()); - auto env = proto.env(); - for (const auto& [key, value] : drv.env) { - RC_ASSERT(env.at(key) == value); - } -} - -class ParseDrvPathWithOutputsTest : public DerivationsTest {}; - -TEST(ParseDrvPathWithOutputsTest, ParseDrvPathWithOutputs) { - auto input = "/nix/store/my51f75kp056md84gq2v08pd140pcz57-test.drv!out"; - auto result = nix::parseDrvPathWithOutputs(input); - - ASSERT_EQ(result.first, - "/nix/store/my51f75kp056md84gq2v08pd140pcz57-test.drv"); - ASSERT_EQ(result.second, nix::PathSet{"out"}); -} - -TEST(ParseDrvPathWithOutputsTest, ParseDrvPathWithMultipleOutputs) { - auto input = "/nix/store/my51f75kp056md84gq2v08pd140pcz57-test.drv!out,dev"; - auto result = nix::parseDrvPathWithOutputs(input); - - nix::PathSet expected = {"out", "dev"}; - - ASSERT_EQ(result.first, - "/nix/store/my51f75kp056md84gq2v08pd140pcz57-test.drv"); - ASSERT_EQ(result.second, expected); -} - -TEST(ParseDrvPathWithOutputsTest, ParseDrvPathWithNoOutputs) { - auto input = "/nix/store/my51f75kp056md84gq2v08pd140pcz57-test"; - auto result = nix::parseDrvPathWithOutputs(input); - - ASSERT_EQ(result.first, "/nix/store/my51f75kp056md84gq2v08pd140pcz57-test"); - ASSERT_EQ(result.second, nix::PathSet()); -} - -} // namespace nix diff --git a/third_party/nix/src/tests/dummy-store.hh b/third_party/nix/src/tests/dummy-store.hh deleted file mode 100644 index 8047d25727e1..000000000000 --- a/third_party/nix/src/tests/dummy-store.hh +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include <filesystem> - -#include "libstore/store-api.hh" - -namespace nix::tests { - -class DummyStore final : public Store { - public: - explicit DummyStore() : Store(Store::Params{}) {} - - std::string getUri() { return ""; } - - void queryPathInfoUncached( - const Path& path, - Callback<std::shared_ptr<ValidPathInfo>> callback) noexcept {} - - Path queryPathFromHashPart(const std::string& hashPart) { return ""; } - - Path addToStore(const std::string& name, const Path& srcPath, - bool recursive = true, HashType hashAlgo = htSHA256, - PathFilter& filter = defaultPathFilter, - RepairFlag repair = NoRepair) { - if (srcPath == "/exists-for-tests") { - return "/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x"; - } - - throw SysError("file does not exist"); - } - - Path addTextToStore(const std::string& name, const std::string& s, - const PathSet& references, RepairFlag repair = NoRepair) { - return "/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x"; - } - - void narFromPath(const Path& path, Sink& sink) {} - - BuildResult buildDerivation(std::ostream& log_sink, const Path& drvPath, - const BasicDerivation& drv, - BuildMode buildMode = bmNormal) { - return BuildResult{}; - } - - void ensurePath(const Path& path) {} -}; - -} // namespace nix::tests diff --git a/third_party/nix/src/tests/hash_test.cc b/third_party/nix/src/tests/hash_test.cc deleted file mode 100644 index caa77f5d6b15..000000000000 --- a/third_party/nix/src/tests/hash_test.cc +++ /dev/null @@ -1,101 +0,0 @@ -#include "libutil/hash.hh" - -#include <gmock/gmock.h> -#include <gtest/gtest.h> - -class HashTest : public ::testing::Test {}; - -using testing::EndsWith; -using testing::HasSubstr; - -namespace nix { - -TEST(HashTest, SHA256) { - auto hash = hashString(HashType::htSHA256, "foo"); - ASSERT_EQ(hash.base64Len(), 44); - ASSERT_EQ(hash.base32Len(), 52); - ASSERT_EQ(hash.base16Len(), 64); - - ASSERT_EQ(hash.to_string(Base16), - "sha256:" - "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"); - ASSERT_EQ(hash.to_string(Base32), - "sha256:1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic"); - ASSERT_EQ(hash.to_string(Base64), - "sha256:LCa0a2j/xo/5m0U8HTBBNBNCLXBkg7+g+YpeiGJm564="); -} - -TEST(HashTest, SHA256Decode) { - auto hash = hashString(HashType::htSHA256, "foo"); - - std::unique_ptr<Hash> base16 = std::make_unique<Hash>( - "sha256:" - "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae", - HashType::htSHA256); - std::unique_ptr<Hash> base32 = std::make_unique<Hash>( - "sha256:1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic", - HashType::htSHA256); - std::unique_ptr<Hash> base64 = std::make_unique<Hash>( - "sha256:LCa0a2j/xo/5m0U8HTBBNBNCLXBkg7+g+YpeiGJm564=", - HashType::htSHA256); - - ASSERT_EQ(hash, *base16); - ASSERT_EQ(hash, *base32); - ASSERT_EQ(hash, *base64); -} - -TEST(HashTest, SHA256DecodeFail) { - EXPECT_THAT( - Hash::deserialize("sha256:LCa0a2j/xo/5m0U8HTBBNBNCLXBkg7+g+YpeiGJm56==", - HashType::htSHA256) - .status() - .message(), - HasSubstr("wrong length")); - EXPECT_THAT( - Hash::deserialize("sha256:LCa0a2j/xo/5m0U8HTBBNBNCLXBkg7+g+YpeiGJm56,=", - HashType::htSHA256) - .status() - .message(), - HasSubstr("invalid base-64")); - - EXPECT_THAT(Hash::deserialize( - "sha256:1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89i", - HashType::htSHA256) - .status() - .message(), - HasSubstr("wrong length")); - absl::StatusOr<Hash> badB32Char = Hash::deserialize( - "sha256:1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89i,", - HashType::htSHA256); - EXPECT_THAT(badB32Char.status().message(), HasSubstr("invalid base-32")); - EXPECT_THAT(badB32Char.status().message(), EndsWith(",")); - - EXPECT_THAT( - Hash::deserialize( - "sha256:" - "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7 ", - HashType::htSHA256) - .status() - .message(), - HasSubstr("invalid base-16")); -} - -TEST(HashSink, SHA256) { - HashSink sink(htSHA256); - - sink.write(reinterpret_cast<const unsigned char*>("fo"), 2); - HashResult partial = sink.currentHash(); - EXPECT_EQ(partial.first.to_string(Base16), - "sha256:" - "9c3aee7110b787f0fb5f81633a36392bd277ea945d44c874a9a23601aefe20cf"); - EXPECT_EQ(partial.second, 2); - - sink.write(reinterpret_cast<const unsigned char*>("o"), 1); - HashResult end = sink.finish(); - EXPECT_EQ(end.first.to_string(Base16), - "sha256:" - "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"); - EXPECT_EQ(end.second, 3); -} - -} // namespace nix diff --git a/third_party/nix/src/tests/lang/binary-data b/third_party/nix/src/tests/lang/binary-data deleted file mode 100644 index 06d740502001..000000000000 --- a/third_party/nix/src/tests/lang/binary-data +++ /dev/null Binary files differdiff --git a/third_party/nix/src/tests/lang/data b/third_party/nix/src/tests/lang/data deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/third_party/nix/src/tests/lang/data +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/third_party/nix/src/tests/lang/dir1/a.nix b/third_party/nix/src/tests/lang/dir1/a.nix deleted file mode 100644 index 231f150c579c..000000000000 --- a/third_party/nix/src/tests/lang/dir1/a.nix +++ /dev/null @@ -1 +0,0 @@ -"a" diff --git a/third_party/nix/src/tests/lang/dir2/a.nix b/third_party/nix/src/tests/lang/dir2/a.nix deleted file mode 100644 index 170df520ab68..000000000000 --- a/third_party/nix/src/tests/lang/dir2/a.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/third_party/nix/src/tests/lang/dir2/b.nix b/third_party/nix/src/tests/lang/dir2/b.nix deleted file mode 100644 index 19010cc35ca6..000000000000 --- a/third_party/nix/src/tests/lang/dir2/b.nix +++ /dev/null @@ -1 +0,0 @@ -"b" diff --git a/third_party/nix/src/tests/lang/dir3/a.nix b/third_party/nix/src/tests/lang/dir3/a.nix deleted file mode 100644 index 170df520ab68..000000000000 --- a/third_party/nix/src/tests/lang/dir3/a.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/third_party/nix/src/tests/lang/dir3/b.nix b/third_party/nix/src/tests/lang/dir3/b.nix deleted file mode 100644 index 170df520ab68..000000000000 --- a/third_party/nix/src/tests/lang/dir3/b.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/third_party/nix/src/tests/lang/dir3/c.nix b/third_party/nix/src/tests/lang/dir3/c.nix deleted file mode 100644 index cdf158597eef..000000000000 --- a/third_party/nix/src/tests/lang/dir3/c.nix +++ /dev/null @@ -1 +0,0 @@ -"c" diff --git a/third_party/nix/src/tests/lang/dir4/a.nix b/third_party/nix/src/tests/lang/dir4/a.nix deleted file mode 100644 index 170df520ab68..000000000000 --- a/third_party/nix/src/tests/lang/dir4/a.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/third_party/nix/src/tests/lang/dir4/c.nix b/third_party/nix/src/tests/lang/dir4/c.nix deleted file mode 100644 index 170df520ab68..000000000000 --- a/third_party/nix/src/tests/lang/dir4/c.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/third_party/nix/src/tests/lang/disabled/README.txt b/third_party/nix/src/tests/lang/disabled/README.txt deleted file mode 100644 index 50225deb63a2..000000000000 --- a/third_party/nix/src/tests/lang/disabled/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -These tests are disabled primarily because the DummyStore used for -tests does not interact with real files on disk at the moment, but the -tests expect it to. - -Once we have a solution for this (potentially just reading & hashing -the files, but not writing them anywhere) these tests will be enabled -again. diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-path.nix b/third_party/nix/src/tests/lang/disabled/eval-okay-path.nix deleted file mode 100644 index e67168cf3edf..000000000000 --- a/third_party/nix/src/tests/lang/disabled/eval-okay-path.nix +++ /dev/null @@ -1,7 +0,0 @@ -builtins.path - { path = ./.; - filter = path: _: baseNameOf path == "data"; - recursive = true; - sha256 = "1yhm3gwvg5a41yylymgblsclk95fs6jy72w0wv925mmidlhcq4sw"; - name = "output"; - } diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.exp b/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.exp deleted file mode 100644 index 4519bc406db5..000000000000 --- a/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.exp +++ /dev/null @@ -1 +0,0 @@ -"abccX" diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.flags b/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.flags deleted file mode 100644 index a28e6821004a..000000000000 --- a/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.flags +++ /dev/null @@ -1 +0,0 @@ --I lang/dir1 -I lang/dir2 -I dir5=lang/dir3 \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.nix b/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.nix deleted file mode 100644 index cca41f821f83..000000000000 --- a/third_party/nix/src/tests/lang/disabled/eval-okay-search-path.nix +++ /dev/null @@ -1,11 +0,0 @@ -with import ./lib.nix; -with builtins; - -assert pathExists <nix/buildenv.nix>; - -assert length __nixPath == 6; -assert length (filter (x: x.prefix == "nix") __nixPath) == 1; -assert length (filter (x: baseNameOf x.path == "dir4") __nixPath) == 1; - -import <a.nix> + import <b.nix> + import <c.nix> + import <dir5/c.nix> - + (let __nixPath = [ { path = ./dir2; } { path = ./dir1; } ]; in import <a.nix>) diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-tail-call-1.nix b/third_party/nix/src/tests/lang/disabled/eval-okay-tail-call-1.nix deleted file mode 100644 index a3962ce3fdb5..000000000000 --- a/third_party/nix/src/tests/lang/disabled/eval-okay-tail-call-1.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - f = n: if n == 100000 then n else f (n + 1); -in f 0 diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-xml.exp b/third_party/nix/src/tests/lang/disabled/eval-okay-xml.exp deleted file mode 100644 index 92b75e0b8b17..000000000000 --- a/third_party/nix/src/tests/lang/disabled/eval-okay-xml.exp +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<expr> - <attrs> - <attr name="a"> - <string value="foo" /> - </attr> - <attr name="at"> - <function> - <attrspat name="args"> - <attr name="x" /> - <attr name="y" /> - <attr name="z" /> - </attrspat> - </function> - </attr> - <attr name="b"> - <string value="bar" /> - </attr> - <attr name="c"> - <string value="foobar" /> - </attr> - <attr name="ellipsis"> - <function> - <attrspat ellipsis="1"> - <attr name="x" /> - <attr name="y" /> - <attr name="z" /> - </attrspat> - </function> - </attr> - <attr name="f"> - <function> - <attrspat> - <attr name="z" /> - <attr name="x" /> - <attr name="y" /> - </attrspat> - </function> - </attr> - <attr name="id"> - <function> - <varpat name="x" /> - </function> - </attr> - <attr name="x"> - <int value="123" /> - </attr> - <attr name="y"> - <float value="567.89" /> - </attr> - </attrs> -</expr> diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-xml.nix b/third_party/nix/src/tests/lang/disabled/eval-okay-xml.nix deleted file mode 100644 index 9ee9f8a0b4f5..000000000000 --- a/third_party/nix/src/tests/lang/disabled/eval-okay-xml.nix +++ /dev/null @@ -1,21 +0,0 @@ -rec { - - x = 123; - - y = 567.890; - - a = "foo"; - - b = "bar"; - - c = "foo" + "bar"; - - f = {z, x, y}: if y then x else z; - - id = x: x; - - at = args@{x, y, z}: x; - - ellipsis = {x, y, z, ...}: x; - -} diff --git a/third_party/nix/src/tests/lang/eval-fail-abort.nix b/third_party/nix/src/tests/lang/eval-fail-abort.nix deleted file mode 100644 index 75c51bceb540..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-abort.nix +++ /dev/null @@ -1 +0,0 @@ -if true then abort "this should fail" else 1 diff --git a/third_party/nix/src/tests/lang/eval-fail-antiquoted-path.nix b/third_party/nix/src/tests/lang/eval-fail-antiquoted-path.nix deleted file mode 100644 index f2f08107b516..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-antiquoted-path.nix +++ /dev/null @@ -1,4 +0,0 @@ -# This must fail to evaluate, since ./fnord doesn't exist. If it did -# exist, it would produce "/nix/store/<hash>-fnord/xyzzy" (with an -# appropriate context). -"${./fnord}/xyzzy" diff --git a/third_party/nix/src/tests/lang/eval-fail-assert.nix b/third_party/nix/src/tests/lang/eval-fail-assert.nix deleted file mode 100644 index 3b7a1e8bf0c2..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-assert.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - x = arg: assert arg == "y"; 123; - - body = x "x"; -} \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-1.nix b/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-1.nix deleted file mode 100644 index ffe9c983c26b..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-1.nix +++ /dev/null @@ -1 +0,0 @@ -"${x: x}" diff --git a/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-2.nix b/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-2.nix deleted file mode 100644 index 3745235ce95e..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-2.nix +++ /dev/null @@ -1 +0,0 @@ -"${./fnord}" diff --git a/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-3.nix b/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-3.nix deleted file mode 100644 index 65b9d4f505b1..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-bad-antiquote-3.nix +++ /dev/null @@ -1 +0,0 @@ -''${x: x}'' diff --git a/third_party/nix/src/tests/lang/eval-fail-blackhole.nix b/third_party/nix/src/tests/lang/eval-fail-blackhole.nix deleted file mode 100644 index 81133b511c95..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-blackhole.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - body = x; - x = y; - y = x; -} diff --git a/third_party/nix/src/tests/lang/eval-fail-deepseq.nix b/third_party/nix/src/tests/lang/eval-fail-deepseq.nix deleted file mode 100644 index 9baa49b063ec..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-deepseq.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.deepSeq { x = abort "foo"; } 456 diff --git a/third_party/nix/src/tests/lang/eval-fail-hashfile-missing.nix b/third_party/nix/src/tests/lang/eval-fail-hashfile-missing.nix deleted file mode 100644 index ce098b82380a..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-hashfile-missing.nix +++ /dev/null @@ -1,5 +0,0 @@ -let - paths = [ ./this-file-is-definitely-not-there-7392097 "/and/neither/is/this/37293620" ]; -in - toString (builtins.concatLists (map (hash: map (builtins.hashFile hash) paths) ["md5" "sha1" "sha256" "sha512"])) - diff --git a/third_party/nix/src/tests/lang/eval-fail-missing-arg.nix b/third_party/nix/src/tests/lang/eval-fail-missing-arg.nix deleted file mode 100644 index c4be9797c534..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-missing-arg.nix +++ /dev/null @@ -1 +0,0 @@ -({x, y, z}: x + y + z) {x = "foo"; z = "bar";} diff --git a/third_party/nix/src/tests/lang/eval-fail-remove.nix b/third_party/nix/src/tests/lang/eval-fail-remove.nix deleted file mode 100644 index 539e0eb0a6f6..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-remove.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - attrs = {x = 123; y = 456;}; - - body = (removeAttrs attrs ["x"]).x; -} \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/eval-fail-scope-5.nix b/third_party/nix/src/tests/lang/eval-fail-scope-5.nix deleted file mode 100644 index f89a65a99be3..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-scope-5.nix +++ /dev/null @@ -1,10 +0,0 @@ -let { - - x = "a"; - y = "b"; - - f = {x ? y, y ? x}: x + y; - - body = f {}; - -} diff --git a/third_party/nix/src/tests/lang/eval-fail-seq.nix b/third_party/nix/src/tests/lang/eval-fail-seq.nix deleted file mode 100644 index cddbbfd3261e..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-seq.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.seq (abort "foo") 2 diff --git a/third_party/nix/src/tests/lang/eval-fail-substring.nix b/third_party/nix/src/tests/lang/eval-fail-substring.nix deleted file mode 100644 index f37c2bc0a160..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-substring.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.substring (builtins.sub 0 1) 1 "x" diff --git a/third_party/nix/src/tests/lang/eval-fail-to-path.nix b/third_party/nix/src/tests/lang/eval-fail-to-path.nix deleted file mode 100644 index 5e322bc31369..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-to-path.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.toPath "foo/bar" diff --git a/third_party/nix/src/tests/lang/eval-fail-undeclared-arg.nix b/third_party/nix/src/tests/lang/eval-fail-undeclared-arg.nix deleted file mode 100644 index cafdf1636272..000000000000 --- a/third_party/nix/src/tests/lang/eval-fail-undeclared-arg.nix +++ /dev/null @@ -1 +0,0 @@ -({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";} diff --git a/third_party/nix/src/tests/lang/eval-okay-any-all.exp b/third_party/nix/src/tests/lang/eval-okay-any-all.exp deleted file mode 100644 index eb273f45b2a6..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-any-all.exp +++ /dev/null @@ -1 +0,0 @@ -[ false false true true true true false true ] diff --git a/third_party/nix/src/tests/lang/eval-okay-any-all.nix b/third_party/nix/src/tests/lang/eval-okay-any-all.nix deleted file mode 100644 index a3f26ea2aa83..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-any-all.nix +++ /dev/null @@ -1,11 +0,0 @@ -with builtins; - -[ (any (x: x == 1) []) - (any (x: x == 1) [2 3 4]) - (any (x: x == 1) [1 2 3 4]) - (any (x: x == 1) [4 3 2 1]) - (all (x: x == 1) []) - (all (x: x == 1) [1]) - (all (x: x == 1) [1 2 3]) - (all (x: x == 1) [1 1 1]) -] diff --git a/third_party/nix/src/tests/lang/eval-okay-arithmetic.exp b/third_party/nix/src/tests/lang/eval-okay-arithmetic.exp deleted file mode 100644 index 5c54d10b7b47..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-arithmetic.exp +++ /dev/null @@ -1 +0,0 @@ -2216 diff --git a/third_party/nix/src/tests/lang/eval-okay-arithmetic.nix b/third_party/nix/src/tests/lang/eval-okay-arithmetic.nix deleted file mode 100644 index 7e9e6a0b666e..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-arithmetic.nix +++ /dev/null @@ -1,59 +0,0 @@ -with import ./lib.nix; - -let { - - /* Supposedly tail recursive version: - - range_ = accum: first: last: - if first == last then ([first] ++ accum) - else range_ ([first] ++ accum) (builtins.add first 1) last; - - range = range_ []; - */ - - x = 12; - - err = abort "urgh"; - - body = sum - [ (sum (range 1 50)) - (123 + 456) - (0 + -10 + -(-11) + -x) - (10 - 7 - -2) - (10 - (6 - -1)) - (10 - 1 + 2) - (3 * 4 * 5) - (56088 / 123 / 2) - (3 + 4 * const 5 0 - 6 / id 2) - - (builtins.bitAnd 12 10) # 0b1100 & 0b1010 = 8 - (builtins.bitOr 12 10) # 0b1100 | 0b1010 = 14 - (builtins.bitXor 12 10) # 0b1100 ^ 0b1010 = 6 - - (if 3 < 7 then 1 else err) - (if 7 < 3 then err else 1) - (if 3 < 3 then err else 1) - - (if 3 <= 7 then 1 else err) - (if 7 <= 3 then err else 1) - (if 3 <= 3 then 1 else err) - - (if 3 > 7 then err else 1) - (if 7 > 3 then 1 else err) - (if 3 > 3 then err else 1) - - (if 3 >= 7 then err else 1) - (if 7 >= 3 then 1 else err) - (if 3 >= 3 then 1 else err) - - (if 2 > 1 == 1 < 2 then 1 else err) - (if 1 + 2 * 3 >= 7 then 1 else err) - (if 1 + 2 * 3 < 7 then err else 1) - - # Not integer, but so what. - (if "aa" < "ab" then 1 else err) - (if "aa" < "aa" then err else 1) - (if "foo" < "foobar" then 1 else err) - ]; - -} diff --git a/third_party/nix/src/tests/lang/eval-okay-attrnames.exp b/third_party/nix/src/tests/lang/eval-okay-attrnames.exp deleted file mode 100644 index b4aa387e07b8..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrnames.exp +++ /dev/null @@ -1 +0,0 @@ -"newxfoonewxy" diff --git a/third_party/nix/src/tests/lang/eval-okay-attrnames.nix b/third_party/nix/src/tests/lang/eval-okay-attrnames.nix deleted file mode 100644 index e5b26e9f2e39..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrnames.nix +++ /dev/null @@ -1,11 +0,0 @@ -with import ./lib.nix; - -let - - attrs = {y = "y"; x = "x"; foo = "foo";} // rec {x = "newx"; bar = x;}; - - names = builtins.attrNames attrs; - - values = map (name: builtins.getAttr name attrs) names; - -in assert values == builtins.attrValues attrs; concat values diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs.exp b/third_party/nix/src/tests/lang/eval-okay-attrs.exp deleted file mode 100644 index 45b0f829eb33..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs.exp +++ /dev/null @@ -1 +0,0 @@ -987 diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs.nix b/third_party/nix/src/tests/lang/eval-okay-attrs.nix deleted file mode 100644 index 810b31a5da96..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; - - body = if as ? a then as.a else assert as ? z; as.z; -} diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs2.exp b/third_party/nix/src/tests/lang/eval-okay-attrs2.exp deleted file mode 100644 index 45b0f829eb33..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs2.exp +++ /dev/null @@ -1 +0,0 @@ -987 diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs2.nix b/third_party/nix/src/tests/lang/eval-okay-attrs2.nix deleted file mode 100644 index 9e06b83ac1fd..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs2.nix +++ /dev/null @@ -1,10 +0,0 @@ -let { - as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; - - A = "a"; - Z = "z"; - - body = if builtins.hasAttr A as - then builtins.getAttr A as - else assert builtins.hasAttr Z as; builtins.getAttr Z as; -} diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs3.exp b/third_party/nix/src/tests/lang/eval-okay-attrs3.exp deleted file mode 100644 index 19de4fdf79f7..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs3.exp +++ /dev/null @@ -1 +0,0 @@ -"foo 22 80 itchyxac" diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs3.nix b/third_party/nix/src/tests/lang/eval-okay-attrs3.nix deleted file mode 100644 index f29de11fe660..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs3.nix +++ /dev/null @@ -1,22 +0,0 @@ -let - - config = - { - services.sshd.enable = true; - services.sshd.port = 22; - services.httpd.port = 80; - hostName = "itchy"; - a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z = "x"; - foo = { - a = "a"; - b.c = "c"; - }; - }; - -in - if config.services.sshd.enable - then "foo ${toString config.services.sshd.port} ${toString config.services.httpd.port} ${config.hostName}" - + "${config.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z}" - + "${config.foo.a}" - + "${config.foo.b.c}" - else "bar" diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs4.exp b/third_party/nix/src/tests/lang/eval-okay-attrs4.exp deleted file mode 100644 index 1851731442d3..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs4.exp +++ /dev/null @@ -1 +0,0 @@ -[ true false true false false true false false ] diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs4.nix b/third_party/nix/src/tests/lang/eval-okay-attrs4.nix deleted file mode 100644 index 43ec81210f38..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs4.nix +++ /dev/null @@ -1,7 +0,0 @@ -let - - as = { x.y.z = 123; a.b.c = 456; }; - - bs = null; - -in [ (as ? x) (as ? y) (as ? x.y.z) (as ? x.y.z.a) (as ? x.y.a) (as ? a.b.c) (bs ? x) (bs ? x.y.z) ] diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs5.exp b/third_party/nix/src/tests/lang/eval-okay-attrs5.exp deleted file mode 100644 index ce0430d78081..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs5.exp +++ /dev/null @@ -1 +0,0 @@ -[ 123 "foo" 456 456 "foo" "xyzzy" "xyzzy" true ] diff --git a/third_party/nix/src/tests/lang/eval-okay-attrs5.nix b/third_party/nix/src/tests/lang/eval-okay-attrs5.nix deleted file mode 100644 index a4584cd3b398..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-attrs5.nix +++ /dev/null @@ -1,21 +0,0 @@ -with import ./lib.nix; - -let - - as = { x.y.z = 123; a.b.c = 456; }; - - bs = { f-o-o.bar = "foo"; }; - - or = x: y: x || y; - -in - [ as.x.y.z - as.foo or "foo" - as.x.y.bla or as.a.b.c - as.a.b.c or as.x.y.z - as.x.y.bla or bs.f-o-o.bar or "xyzzy" - as.x.y.bla or bs.bar.foo or "xyzzy" - (123).bla or null.foo or "xyzzy" - # Backwards compatibility test. - (fold or [] [true false false]) - ] diff --git a/third_party/nix/src/tests/lang/eval-okay-autoargs.flags b/third_party/nix/src/tests/lang/eval-okay-autoargs.flags deleted file mode 100644 index ae3762254460..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-autoargs.flags +++ /dev/null @@ -1 +0,0 @@ ---arg lib import(lang/lib.nix) --argstr xyzzy xyzzy! -A result diff --git a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-1.exp b/third_party/nix/src/tests/lang/eval-okay-backslash-newline-1.exp deleted file mode 100644 index 3e754364cc9c..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-1.exp +++ /dev/null @@ -1 +0,0 @@ -"a\nb" diff --git a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-1.nix b/third_party/nix/src/tests/lang/eval-okay-backslash-newline-1.nix deleted file mode 100644 index 7fef3dddd4dd..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-1.nix +++ /dev/null @@ -1,2 +0,0 @@ -"a\ -b" diff --git a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-2.exp b/third_party/nix/src/tests/lang/eval-okay-backslash-newline-2.exp deleted file mode 100644 index 3e754364cc9c..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-2.exp +++ /dev/null @@ -1 +0,0 @@ -"a\nb" diff --git a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-2.nix b/third_party/nix/src/tests/lang/eval-okay-backslash-newline-2.nix deleted file mode 100644 index 35ddf495c63b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-backslash-newline-2.nix +++ /dev/null @@ -1,2 +0,0 @@ -''a''\ -b'' diff --git a/third_party/nix/src/tests/lang/eval-okay-builtins-add.exp b/third_party/nix/src/tests/lang/eval-okay-builtins-add.exp deleted file mode 100644 index 0350b518a7ec..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-builtins-add.exp +++ /dev/null @@ -1 +0,0 @@ -[ 5 4 "int" "tt" "float" 4 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-builtins-add.nix b/third_party/nix/src/tests/lang/eval-okay-builtins-add.nix deleted file mode 100644 index c841816222a5..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-builtins-add.nix +++ /dev/null @@ -1,8 +0,0 @@ -[ -(builtins.add 2 3) -(builtins.add 2 2) -(builtins.typeOf (builtins.add 2 2)) -("t" + "t") -(builtins.typeOf (builtins.add 2.0 2)) -(builtins.add 2.0 2) -] diff --git a/third_party/nix/src/tests/lang/eval-okay-builtins.exp b/third_party/nix/src/tests/lang/eval-okay-builtins.exp deleted file mode 100644 index 0661686d611d..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-builtins.exp +++ /dev/null @@ -1 +0,0 @@ -/foo diff --git a/third_party/nix/src/tests/lang/eval-okay-builtins.nix b/third_party/nix/src/tests/lang/eval-okay-builtins.nix deleted file mode 100644 index e9d65e88a817..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-builtins.nix +++ /dev/null @@ -1,12 +0,0 @@ -assert builtins ? currentSystem; -assert !builtins ? __currentSystem; - -let { - - x = if builtins ? dirOf then builtins.dirOf /foo/bar else ""; - - y = if builtins ? fnord then builtins.fnord "foo" else ""; - - body = x + y; - -} diff --git a/third_party/nix/src/tests/lang/eval-okay-callable-attrs.exp b/third_party/nix/src/tests/lang/eval-okay-callable-attrs.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-callable-attrs.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-callable-attrs.nix b/third_party/nix/src/tests/lang/eval-okay-callable-attrs.nix deleted file mode 100644 index 310a030df004..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-callable-attrs.nix +++ /dev/null @@ -1 +0,0 @@ -({ __functor = self: x: self.foo && x; foo = false; } // { foo = true; }) true diff --git a/third_party/nix/src/tests/lang/eval-okay-catattrs.exp b/third_party/nix/src/tests/lang/eval-okay-catattrs.exp deleted file mode 100644 index b4a1e66d6b8a..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-catattrs.exp +++ /dev/null @@ -1 +0,0 @@ -[ 1 2 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-catattrs.nix b/third_party/nix/src/tests/lang/eval-okay-catattrs.nix deleted file mode 100644 index 2c3dc10da528..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-catattrs.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.catAttrs "a" [ { a = 1; } { b = 0; } { a = 2; } ] diff --git a/third_party/nix/src/tests/lang/eval-okay-closure.exp b/third_party/nix/src/tests/lang/eval-okay-closure.exp deleted file mode 100644 index e7dbf978160d..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-closure.exp +++ /dev/null @@ -1 +0,0 @@ -[ { foo = true; key = -13; } { foo = true; key = -12; } { foo = true; key = -11; } { foo = true; key = -9; } { foo = true; key = -8; } { foo = true; key = -7; } { foo = true; key = -5; } { foo = true; key = -4; } { foo = true; key = -3; } { key = -1; } { foo = true; key = 0; } { foo = true; key = 1; } { foo = true; key = 2; } { foo = true; key = 4; } { foo = true; key = 5; } { foo = true; key = 6; } { key = 8; } { foo = true; key = 9; } { foo = true; key = 10; } { foo = true; key = 13; } { foo = true; key = 14; } { foo = true; key = 15; } { key = 17; } { foo = true; key = 18; } { foo = true; key = 19; } { foo = true; key = 22; } { foo = true; key = 23; } { key = 26; } { foo = true; key = 27; } { foo = true; key = 28; } { foo = true; key = 31; } { foo = true; key = 32; } { key = 35; } { foo = true; key = 36; } { foo = true; key = 40; } { foo = true; key = 41; } { key = 44; } { foo = true; key = 45; } { foo = true; key = 49; } { key = 53; } { foo = true; key = 54; } { foo = true; key = 58; } { key = 62; } { foo = true; key = 67; } { key = 71; } { key = 80; } ] diff --git a/third_party/nix/src/tests/lang/eval-okay-closure.nix b/third_party/nix/src/tests/lang/eval-okay-closure.nix deleted file mode 100644 index cccd4dc35730..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-closure.nix +++ /dev/null @@ -1,13 +0,0 @@ -let - - closure = builtins.genericClosure { - startSet = [{key = 80;}]; - operator = {key, foo ? false}: - if builtins.lessThan key 0 - then [] - else [{key = builtins.sub key 9;} {key = builtins.sub key 13; foo = true;}]; - }; - - sort = (import ./lib.nix).sortBy (a: b: builtins.lessThan a.key b.key); - -in sort closure diff --git a/third_party/nix/src/tests/lang/eval-okay-comments.exp b/third_party/nix/src/tests/lang/eval-okay-comments.exp deleted file mode 100644 index 7182dc2f9b8e..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-comments.exp +++ /dev/null @@ -1 +0,0 @@ -"abcdefghijklmnopqrstuvwxyz" diff --git a/third_party/nix/src/tests/lang/eval-okay-comments.nix b/third_party/nix/src/tests/lang/eval-okay-comments.nix deleted file mode 100644 index cb2cce218029..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-comments.nix +++ /dev/null @@ -1,59 +0,0 @@ -# A simple comment -"a"+ # And another -## A double comment -"b"+ ## And another -# Nested # comments # -"c"+ # and # some # other # -# An empty line, following here: - -"d"+ # and a comment not starting the line ! - -"e"+ -/* multiline comments */ -"f" + -/* multiline - comments, - on - multiple - lines -*/ -"g" + -# Small, tricky comments -/**/ "h"+ /*/*/ "i"+ /***/ "j"+ /* /*/ "k"+ /*/* /*/ "l"+ -# Comments with an even number of ending '*' used to fail: -"m"+ -/* */ /* **/ /* ***/ /* ****/ "n"+ -/* */ /** */ /*** */ /**** */ "o"+ -/** **/ /*** ***/ /**** ****/ "p"+ -/* * ** *** **** ***** */ "q"+ -# Random comments -/* ***** ////// * / * / /* */ "r"+ -# Mixed comments -/* # */ -"s"+ -# /* # -"t"+ -# /* # */ -"u"+ -# /*********/ -"v"+ -## */* -"w"+ -/* - * Multiline, decorated comments - * # This ain't a nest'd comm'nt - */ -"x"+ -''${/** with **/"y" - # real - /* comments - inside ! # */ - - # (and empty lines) - -}''+ /* And a multiline comment, - on the same line, - after some spaces -*/ # followed by a one-line comment -"z" -/* EOF */ diff --git a/third_party/nix/src/tests/lang/eval-okay-concat.exp b/third_party/nix/src/tests/lang/eval-okay-concat.exp deleted file mode 100644 index bb4bbd577410..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-concat.exp +++ /dev/null @@ -1 +0,0 @@ -[ 1 2 3 4 5 6 7 8 9 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-concat.nix b/third_party/nix/src/tests/lang/eval-okay-concat.nix deleted file mode 100644 index d158a9bf05b9..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-concat.nix +++ /dev/null @@ -1 +0,0 @@ -[1 2 3] ++ [4 5 6] ++ [7 8 9] diff --git a/third_party/nix/src/tests/lang/eval-okay-concatmap.exp b/third_party/nix/src/tests/lang/eval-okay-concatmap.exp deleted file mode 100644 index 3b8be7739deb..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-concatmap.exp +++ /dev/null @@ -1 +0,0 @@ -[ [ 1 3 5 7 9 ] [ "a" "z" "b" "z" ] ] diff --git a/third_party/nix/src/tests/lang/eval-okay-concatmap.nix b/third_party/nix/src/tests/lang/eval-okay-concatmap.nix deleted file mode 100644 index 97da5d37a412..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-concatmap.nix +++ /dev/null @@ -1,5 +0,0 @@ -with import ./lib.nix; - -[ (builtins.concatMap (x: if x / 2 * 2 == x then [] else [ x ]) (range 0 10)) - (builtins.concatMap (x: [x] ++ ["z"]) ["a" "b"]) -] diff --git a/third_party/nix/src/tests/lang/eval-okay-concatstringssep.exp b/third_party/nix/src/tests/lang/eval-okay-concatstringssep.exp deleted file mode 100644 index 93987647ffe6..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-concatstringssep.exp +++ /dev/null @@ -1 +0,0 @@ -[ "" "foobarxyzzy" "foo, bar, xyzzy" "foo" "" ] diff --git a/third_party/nix/src/tests/lang/eval-okay-concatstringssep.nix b/third_party/nix/src/tests/lang/eval-okay-concatstringssep.nix deleted file mode 100644 index adc4c41bd551..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-concatstringssep.nix +++ /dev/null @@ -1,8 +0,0 @@ -with builtins; - -[ (concatStringsSep "" []) - (concatStringsSep "" ["foo" "bar" "xyzzy"]) - (concatStringsSep ", " ["foo" "bar" "xyzzy"]) - (concatStringsSep ", " ["foo"]) - (concatStringsSep ", " []) -] diff --git a/third_party/nix/src/tests/lang/eval-okay-curpos.exp b/third_party/nix/src/tests/lang/eval-okay-curpos.exp deleted file mode 100644 index 65fd65b4d01f..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-curpos.exp +++ /dev/null @@ -1 +0,0 @@ -[ 3 7 4 9 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-curpos.nix b/third_party/nix/src/tests/lang/eval-okay-curpos.nix deleted file mode 100644 index b79553df0bd3..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-curpos.nix +++ /dev/null @@ -1,5 +0,0 @@ -# Bla -let - x = __curPos; - y = __curPos; -in [ x.line x.column y.line y.column ] diff --git a/third_party/nix/src/tests/lang/eval-okay-deepseq.exp b/third_party/nix/src/tests/lang/eval-okay-deepseq.exp deleted file mode 100644 index 8d38505c1686..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-deepseq.exp +++ /dev/null @@ -1 +0,0 @@ -456 diff --git a/third_party/nix/src/tests/lang/eval-okay-deepseq.nix b/third_party/nix/src/tests/lang/eval-okay-deepseq.nix deleted file mode 100644 index 53aa4b1dc251..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-deepseq.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.deepSeq (let as = { x = 123; y = as; }; in as) 456 diff --git a/third_party/nix/src/tests/lang/eval-okay-delayed-with-inherit.exp b/third_party/nix/src/tests/lang/eval-okay-delayed-with-inherit.exp deleted file mode 100644 index eaacb55c1aff..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-delayed-with-inherit.exp +++ /dev/null @@ -1 +0,0 @@ -"b-overridden" diff --git a/third_party/nix/src/tests/lang/eval-okay-delayed-with-inherit.nix b/third_party/nix/src/tests/lang/eval-okay-delayed-with-inherit.nix deleted file mode 100644 index 84b388c27130..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-delayed-with-inherit.nix +++ /dev/null @@ -1,24 +0,0 @@ -let - pkgs_ = with pkgs; { - a = derivation { - name = "a"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - inherit b; - }; - - inherit b; - }; - - packageOverrides = p: { - b = derivation { - name = "b-overridden"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - }; - }; - - pkgs = pkgs_ // (packageOverrides pkgs_); -in pkgs.a.b.name diff --git a/third_party/nix/src/tests/lang/eval-okay-delayed-with.exp b/third_party/nix/src/tests/lang/eval-okay-delayed-with.exp deleted file mode 100644 index 8e7c61ab8e77..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-delayed-with.exp +++ /dev/null @@ -1 +0,0 @@ -"b-overridden b-overridden a" diff --git a/third_party/nix/src/tests/lang/eval-okay-delayed-with.nix b/third_party/nix/src/tests/lang/eval-okay-delayed-with.nix deleted file mode 100644 index 3fb023e1cd42..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-delayed-with.nix +++ /dev/null @@ -1,29 +0,0 @@ -let - - pkgs_ = with pkgs; { - a = derivation { - name = "a"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - inherit b; - }; - - b = derivation { - name = "b"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - inherit a; - }; - - c = b; - }; - - packageOverrides = pkgs: with pkgs; { - b = derivation (b.drvAttrs // { name = "${b.name}-overridden"; }); - }; - - pkgs = pkgs_ // (packageOverrides pkgs_); - -in "${pkgs.a.b.name} ${pkgs.c.name} ${pkgs.b.a.name}" diff --git a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-2.exp b/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-2.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-2.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-2.nix b/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-2.nix deleted file mode 100644 index 6d57bf854908..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-2.nix +++ /dev/null @@ -1 +0,0 @@ -{ a."${"b"}" = true; a."${"c"}" = false; }.a.b diff --git a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-bare.exp b/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-bare.exp deleted file mode 100644 index df8750afc036..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-bare.exp +++ /dev/null @@ -1 +0,0 @@ -{ binds = true; hasAttrs = true; multiAttrs = true; recBinds = true; selectAttrs = true; selectOrAttrs = true; } diff --git a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-bare.nix b/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-bare.nix deleted file mode 100644 index 0dbe15e6384c..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs-bare.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - aString = "a"; - - bString = "b"; -in { - hasAttrs = { a.b = null; } ? ${aString}.b; - - selectAttrs = { a.b = true; }.a.${bString}; - - selectOrAttrs = { }.${aString} or true; - - binds = { ${aString}."${bString}c" = true; }.a.bc; - - recBinds = rec { ${bString} = a; a = true; }.b; - - multiAttrs = { ${aString} = true; ${bString} = false; }.a; -} diff --git a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs.exp b/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs.exp deleted file mode 100644 index df8750afc036..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs.exp +++ /dev/null @@ -1 +0,0 @@ -{ binds = true; hasAttrs = true; multiAttrs = true; recBinds = true; selectAttrs = true; selectOrAttrs = true; } diff --git a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs.nix b/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs.nix deleted file mode 100644 index ee02ac7e6579..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-dynamic-attrs.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - aString = "a"; - - bString = "b"; -in { - hasAttrs = { a.b = null; } ? "${aString}".b; - - selectAttrs = { a.b = true; }.a."${bString}"; - - selectOrAttrs = { }."${aString}" or true; - - binds = { "${aString}"."${bString}c" = true; }.a.bc; - - recBinds = rec { "${bString}" = a; a = true; }.b; - - multiAttrs = { "${aString}" = true; "${bString}" = false; }.a; -} diff --git a/third_party/nix/src/tests/lang/eval-okay-elem.exp b/third_party/nix/src/tests/lang/eval-okay-elem.exp deleted file mode 100644 index 3cf6c0e962f0..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-elem.exp +++ /dev/null @@ -1 +0,0 @@ -[ true false 30 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-elem.nix b/third_party/nix/src/tests/lang/eval-okay-elem.nix deleted file mode 100644 index 71ea7a4ed03d..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-elem.nix +++ /dev/null @@ -1,6 +0,0 @@ -with import ./lib.nix; - -let xs = range 10 40; in - -[ (builtins.elem 23 xs) (builtins.elem 42 xs) (builtins.elemAt xs 20) ] - diff --git a/third_party/nix/src/tests/lang/eval-okay-empty-args.exp b/third_party/nix/src/tests/lang/eval-okay-empty-args.exp deleted file mode 100644 index cb5537d5d7ce..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-empty-args.exp +++ /dev/null @@ -1 +0,0 @@ -"ab" diff --git a/third_party/nix/src/tests/lang/eval-okay-empty-args.nix b/third_party/nix/src/tests/lang/eval-okay-empty-args.nix deleted file mode 100644 index 78c133afdd94..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-empty-args.nix +++ /dev/null @@ -1 +0,0 @@ -({}: {x,y,}: "${x}${y}") {} {x = "a"; y = "b";} diff --git a/third_party/nix/src/tests/lang/eval-okay-eq-derivations.exp b/third_party/nix/src/tests/lang/eval-okay-eq-derivations.exp deleted file mode 100644 index ec04aab6aeec..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-eq-derivations.exp +++ /dev/null @@ -1 +0,0 @@ -[ true true true false ] diff --git a/third_party/nix/src/tests/lang/eval-okay-eq-derivations.nix b/third_party/nix/src/tests/lang/eval-okay-eq-derivations.nix deleted file mode 100644 index d526cb4a2161..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-eq-derivations.nix +++ /dev/null @@ -1,10 +0,0 @@ -let - - drvA1 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; }; - drvA2 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; }; - drvA3 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; } // { dummy = 1; }; - - drvC1 = derivation { name = "c"; builder = "/foo"; system = "i686-linux"; }; - drvC2 = derivation { name = "c"; builder = "/bar"; system = "i686-linux"; }; - -in [ (drvA1 == drvA1) (drvA1 == drvA2) (drvA1 == drvA3) (drvC1 == drvC2) ] diff --git a/third_party/nix/src/tests/lang/eval-okay-eq.exp b/third_party/nix/src/tests/lang/eval-okay-eq.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-eq.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-eq.nix b/third_party/nix/src/tests/lang/eval-okay-eq.nix deleted file mode 100644 index 73d200b38141..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-eq.nix +++ /dev/null @@ -1,3 +0,0 @@ -["foobar" (rec {x = 1; y = x;})] -== -[("foo" + "bar") ({x = 1; y = 1;})] diff --git a/third_party/nix/src/tests/lang/eval-okay-filter.exp b/third_party/nix/src/tests/lang/eval-okay-filter.exp deleted file mode 100644 index 355d51c27d8f..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-filter.exp +++ /dev/null @@ -1 +0,0 @@ -[ 0 2 4 6 8 10 100 102 104 106 108 110 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-filter.nix b/third_party/nix/src/tests/lang/eval-okay-filter.nix deleted file mode 100644 index 85109b0d0eb8..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-filter.nix +++ /dev/null @@ -1,5 +0,0 @@ -with import ./lib.nix; - -builtins.filter - (x: x / 2 * 2 == x) - (builtins.concatLists [ (range 0 10) (range 100 110) ]) diff --git a/third_party/nix/src/tests/lang/eval-okay-flatten.exp b/third_party/nix/src/tests/lang/eval-okay-flatten.exp deleted file mode 100644 index b979b2b8b9bc..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-flatten.exp +++ /dev/null @@ -1 +0,0 @@ -"1234567" diff --git a/third_party/nix/src/tests/lang/eval-okay-flatten.nix b/third_party/nix/src/tests/lang/eval-okay-flatten.nix deleted file mode 100644 index fe911e9683e2..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-flatten.nix +++ /dev/null @@ -1,8 +0,0 @@ -with import ./lib.nix; - -let { - - l = ["1" "2" ["3" ["4"] ["5" "6"]] "7"]; - - body = concat (flatten l); -} diff --git a/third_party/nix/src/tests/lang/eval-okay-float.exp b/third_party/nix/src/tests/lang/eval-okay-float.exp deleted file mode 100644 index 3c50a8adce86..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-float.exp +++ /dev/null @@ -1 +0,0 @@ -[ 3.4 3.5 2.5 1.5 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-float.nix b/third_party/nix/src/tests/lang/eval-okay-float.nix deleted file mode 100644 index b2702c7b1668..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-float.nix +++ /dev/null @@ -1,6 +0,0 @@ -[ - (1.1 + 2.3) - (builtins.add (0.5 + 0.5) (2.0 + 0.5)) - ((0.5 + 0.5) * (2.0 + 0.5)) - ((1.5 + 1.5) / (0.5 * 4.0)) -] diff --git a/third_party/nix/src/tests/lang/eval-okay-fromTOML.exp b/third_party/nix/src/tests/lang/eval-okay-fromTOML.exp deleted file mode 100644 index d0dd3af2c814..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-fromTOML.exp +++ /dev/null @@ -1 +0,0 @@ -[ { clients = { data = [ [ "gamma" "delta" ] [ 1 2 ] ]; hosts = [ "alpha" "omega" ]; }; database = { connection_max = 5000; enabled = true; ports = [ 8001 8001 8002 ]; server = "192.168.1.1"; }; owner = { name = "Tom Preston-Werner"; }; servers = { alpha = { dc = "eqdc10"; ip = "10.0.0.1"; }; beta = { dc = "eqdc10"; ip = "10.0.0.2"; }; }; title = "TOML Example"; } { "1234" = "value"; "127.0.0.1" = "value"; a = { b = { c = { }; }; }; arr1 = [ 1 2 3 ]; arr2 = [ "red" "yellow" "green" ]; arr3 = [ [ 1 2 ] [ 3 4 5 ] ]; arr4 = [ "all" "strings" "are the same" "type" ]; arr5 = [ [ 1 2 ] [ "a" "b" "c" ] ]; arr7 = [ 1 2 3 ]; arr8 = [ 1 2 ]; bare-key = "value"; bare_key = "value"; bin1 = 214; bool1 = true; bool2 = false; "character encoding" = "value"; d = { e = { f = { }; }; }; dog = { "tater.man" = { type = { name = "pug"; }; }; }; flt1 = 1; flt2 = 3.1415; flt3 = -0.01; flt4 = 5e+22; flt5 = 1e+06; flt6 = -0.02; flt7 = 6.626e-34; flt8 = 9.22462e+06; fruit = [ { name = "apple"; physical = { color = "red"; shape = "round"; }; variety = [ { name = "red delicious"; } { name = "granny smith"; } ]; } { name = "banana"; variety = [ { name = "plantain"; } ]; } ]; g = { h = { i = { }; }; }; hex1 = 3735928559; hex2 = 3735928559; hex3 = 3735928559; int1 = 99; int2 = 42; int3 = 0; int4 = -17; int5 = 1000; int6 = 5349221; int7 = 12345; j = { "ʞ" = { l = { }; }; }; key = "value"; key2 = "value"; name = "Orange"; oct1 = 342391; oct2 = 493; physical = { color = "orange"; shape = "round"; }; products = [ { name = "Hammer"; sku = 738594937; } { } { color = "gray"; name = "Nail"; sku = 284758393; } ]; "quoted \"value\"" = "value"; site = { "google.com" = true; }; str = "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."; table-1 = { key1 = "some string"; key2 = 123; }; table-2 = { key1 = "another string"; key2 = 456; }; x = { y = { z = { w = { animal = { type = { name = "pug"; }; }; name = { first = "Tom"; last = "Preston-Werner"; }; point = { x = 1; y = 2; }; }; }; }; }; "ʎǝʞ" = "value"; } { metadata = { "checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"; "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"; "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"; "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"; }; package = [ { dependencies = [ "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" ]; name = "aho-corasick"; source = "registry+https://github.com/rust-lang/crates.io-index"; version = "0.6.4"; } { name = "ansi_term"; source = "registry+https://github.com/rust-lang/crates.io-index"; version = "0.9.0"; } { dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" ]; name = "atty"; source = "registry+https://github.com/rust-lang/crates.io-index"; version = "0.2.10"; } ]; } { a = [ [ { b = true; } ] ]; c = [ [ { d = true; } ] ]; e = [ [ 123 ] ]; } ] diff --git a/third_party/nix/src/tests/lang/eval-okay-fromTOML.nix b/third_party/nix/src/tests/lang/eval-okay-fromTOML.nix deleted file mode 100644 index 963932689942..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-fromTOML.nix +++ /dev/null @@ -1,208 +0,0 @@ -[ - - (builtins.fromTOML '' - # This is a TOML document. - - title = "TOML Example" - - [owner] - name = "Tom Preston-Werner" - #dob = 1979-05-27T07:32:00-08:00 # First class dates - - [database] - server = "192.168.1.1" - ports = [ 8001, 8001, 8002 ] - connection_max = 5000 - enabled = true - - [servers] - - # Indentation (tabs and/or spaces) is allowed but not required - [servers.alpha] - ip = "10.0.0.1" - dc = "eqdc10" - - [servers.beta] - ip = "10.0.0.2" - dc = "eqdc10" - - [clients] - data = [ ["gamma", "delta"], [1, 2] ] - - # Line breaks are OK when inside arrays - hosts = [ - "alpha", - "omega" - ] - '') - - (builtins.fromTOML '' - key = "value" - bare_key = "value" - bare-key = "value" - 1234 = "value" - - "127.0.0.1" = "value" - "character encoding" = "value" - "ʎǝʞ" = "value" - 'key2' = "value" - 'quoted "value"' = "value" - - name = "Orange" - - physical.color = "orange" - physical.shape = "round" - site."google.com" = true - - # This is legal according to the spec, but cpptoml doesn't handle it. - #a.b.c = 1 - #a.d = 2 - - str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." - - int1 = +99 - int2 = 42 - int3 = 0 - int4 = -17 - int5 = 1_000 - int6 = 5_349_221 - int7 = 1_2_3_4_5 - - hex1 = 0xDEADBEEF - hex2 = 0xdeadbeef - hex3 = 0xdead_beef - - oct1 = 0o01234567 - oct2 = 0o755 - - bin1 = 0b11010110 - - flt1 = +1.0 - flt2 = 3.1415 - flt3 = -0.01 - flt4 = 5e+22 - flt5 = 1e6 - flt6 = -2E-2 - flt7 = 6.626e-34 - flt8 = 9_224_617.445_991_228_313 - - bool1 = true - bool2 = false - - # FIXME: not supported because Nix doesn't have a date/time type. - #odt1 = 1979-05-27T07:32:00Z - #odt2 = 1979-05-27T00:32:00-07:00 - #odt3 = 1979-05-27T00:32:00.999999-07:00 - #odt4 = 1979-05-27 07:32:00Z - #ldt1 = 1979-05-27T07:32:00 - #ldt2 = 1979-05-27T00:32:00.999999 - #ld1 = 1979-05-27 - #lt1 = 07:32:00 - #lt2 = 00:32:00.999999 - - arr1 = [ 1, 2, 3 ] - arr2 = [ "red", "yellow", "green" ] - arr3 = [ [ 1, 2 ], [3, 4, 5] ] - arr4 = [ "all", 'strings', """are the same""", ''''type''''] - arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] - - arr7 = [ - 1, 2, 3 - ] - - arr8 = [ - 1, - 2, # this is ok - ] - - [table-1] - key1 = "some string" - key2 = 123 - - - [table-2] - key1 = "another string" - key2 = 456 - - [dog."tater.man"] - type.name = "pug" - - [a.b.c] - [ d.e.f ] - [ g . h . i ] - [ j . "ʞ" . 'l' ] - [x.y.z.w] - - name = { first = "Tom", last = "Preston-Werner" } - point = { x = 1, y = 2 } - animal = { type.name = "pug" } - - [[products]] - name = "Hammer" - sku = 738594937 - - [[products]] - - [[products]] - name = "Nail" - sku = 284758393 - color = "gray" - - [[fruit]] - name = "apple" - - [fruit.physical] - color = "red" - shape = "round" - - [[fruit.variety]] - name = "red delicious" - - [[fruit.variety]] - name = "granny smith" - - [[fruit]] - name = "banana" - - [[fruit.variety]] - name = "plantain" - '') - - (builtins.fromTOML '' - [[package]] - name = "aho-corasick" - version = "0.6.4" - source = "registry+https://github.com/rust-lang/crates.io-index" - dependencies = [ - "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - ] - - [[package]] - name = "ansi_term" - version = "0.9.0" - source = "registry+https://github.com/rust-lang/crates.io-index" - - [[package]] - name = "atty" - version = "0.2.10" - source = "registry+https://github.com/rust-lang/crates.io-index" - dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - ] - - [metadata] - "checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" - "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" - "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" - "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" - '') - - (builtins.fromTOML '' - a = [[{ b = true }]] - c = [ [ { d = true } ] ] - e = [[123]] - '') - -] diff --git a/third_party/nix/src/tests/lang/eval-okay-fromjson.exp b/third_party/nix/src/tests/lang/eval-okay-fromjson.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-fromjson.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-fromjson.nix b/third_party/nix/src/tests/lang/eval-okay-fromjson.nix deleted file mode 100644 index 102ee82b5e6b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-fromjson.nix +++ /dev/null @@ -1,36 +0,0 @@ -# RFC 7159, section 13. -builtins.fromJSON - '' - { - "Image": { - "Width": 800, - "Height": 600, - "Title": "View from 15th Floor", - "Thumbnail": { - "Url": "http://www.example.com/image/481989943", - "Height": 125, - "Width": 100 - }, - "Animated" : false, - "IDs": [116, 943, 234, 38793, true ,false,null, -100], - "Latitude": 37.7668, - "Longitude": -122.3959 - } - } - '' -== - { Image = - { Width = 800; - Height = 600; - Title = "View from 15th Floor"; - Thumbnail = - { Url = http://www.example.com/image/481989943; - Height = 125; - Width = 100; - }; - Animated = false; - IDs = [ 116 943 234 38793 true false null (0-100) ]; - Latitude = 37.7668; - Longitude = -122.3959; - }; - } diff --git a/third_party/nix/src/tests/lang/eval-okay-functionargs.exp b/third_party/nix/src/tests/lang/eval-okay-functionargs.exp deleted file mode 100644 index f8ddea8e0bfa..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-functionargs.exp +++ /dev/null @@ -1 +0,0 @@ -[ { aterm = false; fetchurl = false; stdenv = false; } { color = false; name = true; } { } { } { } "stdenv" "fetchurl" "aterm-stdenv" "aterm-stdenv2" "libX11" "libXv" "mplayer-stdenv2.libXv-libX11" "mplayer-stdenv2.libXv-libX11_2" "nix-stdenv-aterm-stdenv" "nix-stdenv2-aterm2-stdenv2" ] diff --git a/third_party/nix/src/tests/lang/eval-okay-functionargs.nix b/third_party/nix/src/tests/lang/eval-okay-functionargs.nix deleted file mode 100644 index 205bbf307aa7..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-functionargs.nix +++ /dev/null @@ -1,89 +0,0 @@ -let - - stdenvFun = { }: { name = "stdenv"; }; - stdenv2Fun = { }: { name = "stdenv2"; }; - fetchurlFun = { stdenv }: assert stdenv.name == "stdenv"; { name = "fetchurl"; }; - atermFun = { stdenv, fetchurl }: { name = "aterm-${stdenv.name}"; }; - aterm2Fun = { stdenv, fetchurl }: { name = "aterm2-${stdenv.name}"; }; - nixFun = { stdenv, fetchurl, aterm }: { name = "nix-${stdenv.name}-${aterm.name}"; }; - - trivialFunctionArgsUsage = [ - (builtins.functionArgs nixFun) - (builtins.functionArgs ({ name ? "Karl", color }: "${name} is ${color}")) - (builtins.functionArgs (x: y: x + y)) - (builtins.functionArgs builtins.map) - (builtins.functionArgs builtins.fetchurl) - ]; - - mplayerFun = - { stdenv, fetchurl, enableX11 ? false, xorg ? null, enableFoo ? true, foo ? null }: - assert stdenv.name == "stdenv2"; - assert enableX11 -> xorg.libXv.name == "libXv"; - assert enableFoo -> foo != null; - { name = "mplayer-${stdenv.name}.${xorg.libXv.name}-${xorg.libX11.name}"; }; - - makeOverridable = f: origArgs: f origArgs // - { override = newArgs: - makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs)); - }; - - callPackage_ = pkgs: f: args: - makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f) pkgs) // args); - - allPackages = - { overrides ? (pkgs: pkgsPrev: { }) }: - let - callPackage = callPackage_ pkgs; - pkgs = pkgsStd // (overrides pkgs pkgsStd); - pkgsStd = { - inherit pkgs; - stdenv = callPackage stdenvFun { }; - stdenv2 = callPackage stdenv2Fun { }; - fetchurl = callPackage fetchurlFun { }; - aterm = callPackage atermFun { }; - xorg = callPackage xorgFun { }; - mplayer = callPackage mplayerFun { stdenv = pkgs.stdenv2; enableFoo = false; }; - nix = callPackage nixFun { }; - }; - in pkgs; - - libX11Fun = { stdenv, fetchurl }: { name = "libX11"; }; - libX11_2Fun = { stdenv, fetchurl }: { name = "libX11_2"; }; - libXvFun = { stdenv, fetchurl, libX11 }: { name = "libXv"; }; - - xorgFun = - { pkgs }: - let callPackage = callPackage_ (pkgs // pkgs.xorg); in - { - libX11 = callPackage libX11Fun { }; - libXv = callPackage libXvFun { }; - }; - -in - -let - - pkgs = allPackages { }; - - pkgs2 = allPackages { - overrides = pkgs: pkgsPrev: { - stdenv = pkgs.stdenv2; - nix = pkgsPrev.nix.override { aterm = aterm2Fun { inherit (pkgs) stdenv fetchurl; }; }; - xorg = pkgsPrev.xorg // { libX11 = libX11_2Fun { inherit (pkgs) stdenv fetchurl; }; }; - }; - }; - -in - - trivialFunctionArgsUsage ++ [ - pkgs.stdenv.name - pkgs.fetchurl.name - pkgs.aterm.name - pkgs2.aterm.name - pkgs.xorg.libX11.name - pkgs.xorg.libXv.name - pkgs.mplayer.name - pkgs2.mplayer.name - pkgs.nix.name - pkgs2.nix.name - ] diff --git a/third_party/nix/src/tests/lang/eval-okay-getattrpos-undefined.exp b/third_party/nix/src/tests/lang/eval-okay-getattrpos-undefined.exp deleted file mode 100644 index 19765bd501b6..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-getattrpos-undefined.exp +++ /dev/null @@ -1 +0,0 @@ -null diff --git a/third_party/nix/src/tests/lang/eval-okay-getattrpos-undefined.nix b/third_party/nix/src/tests/lang/eval-okay-getattrpos-undefined.nix deleted file mode 100644 index 14dd38f7734c..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-getattrpos-undefined.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.unsafeGetAttrPos "abort" builtins diff --git a/third_party/nix/src/tests/lang/eval-okay-getattrpos.exp b/third_party/nix/src/tests/lang/eval-okay-getattrpos.exp deleted file mode 100644 index 469249bbc646..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-getattrpos.exp +++ /dev/null @@ -1 +0,0 @@ -{ column = 5; file = "eval-okay-getattrpos.nix"; line = 3; } diff --git a/third_party/nix/src/tests/lang/eval-okay-getattrpos.nix b/third_party/nix/src/tests/lang/eval-okay-getattrpos.nix deleted file mode 100644 index ca6b07961547..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-getattrpos.nix +++ /dev/null @@ -1,6 +0,0 @@ -let - as = { - foo = "bar"; - }; - pos = builtins.unsafeGetAttrPos "foo" as; -in { inherit (pos) column line; file = baseNameOf pos.file; } diff --git a/third_party/nix/src/tests/lang/eval-okay-getenv.exp b/third_party/nix/src/tests/lang/eval-okay-getenv.exp deleted file mode 100644 index 14e24d419005..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-getenv.exp +++ /dev/null @@ -1 +0,0 @@ -"foobar" diff --git a/third_party/nix/src/tests/lang/eval-okay-getenv.nix b/third_party/nix/src/tests/lang/eval-okay-getenv.nix deleted file mode 100644 index ea8bb9f0a629..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-getenv.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.getEnv "NIX_TEST_VAR" + (if builtins.getEnv "NO_SUCH_VAR" == "" then "bar" else "bla") diff --git a/third_party/nix/src/tests/lang/eval-okay-hash.exp b/third_party/nix/src/tests/lang/eval-okay-hash.exp deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-hash.exp +++ /dev/null diff --git a/third_party/nix/src/tests/lang/eval-okay-hashfile.exp b/third_party/nix/src/tests/lang/eval-okay-hashfile.exp deleted file mode 100644 index ff1e8293ef22..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-hashfile.exp +++ /dev/null @@ -1 +0,0 @@ -[ "d3b07384d113edec49eaa6238ad5ff00" "0f343b0931126a20f133d67c2b018a3b" "f1d2d2f924e986ac86fdf7b36c94bcdf32beec15" "60cacbf3d72e1e7834203da608037b1bf83b40e8" "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c" "5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" "0cf9180a764aba863a67b6d72f0918bc131c6772642cb2dce5a34f0a702f9470ddc2bf125c12198b1995c233c34b4afd346c54a2334c350a948a51b6e8b4e6b6" "8efb4f73c5655351c444eb109230c556d39e2c7624e9c11abc9e3fb4b9b9254218cc5085b454a9698d085cfa92198491f07a723be4574adc70617b73eb0b6461" ] diff --git a/third_party/nix/src/tests/lang/eval-okay-hashfile.nix b/third_party/nix/src/tests/lang/eval-okay-hashfile.nix deleted file mode 100644 index aff5a1856814..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-hashfile.nix +++ /dev/null @@ -1,4 +0,0 @@ -let - paths = [ ./data ./binary-data ]; -in - builtins.concatLists (map (hash: map (builtins.hashFile hash) paths) ["md5" "sha1" "sha256" "sha512"]) diff --git a/third_party/nix/src/tests/lang/eval-okay-hashstring.exp b/third_party/nix/src/tests/lang/eval-okay-hashstring.exp deleted file mode 100644 index d720a082ddb3..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-hashstring.exp +++ /dev/null @@ -1 +0,0 @@ -[ "d41d8cd98f00b204e9800998ecf8427e" "6c69ee7f211c640419d5366cc076ae46" "bb3438fbabd460ea6dbd27d153e2233b" "da39a3ee5e6b4b0d3255bfef95601890afd80709" "cd54e8568c1b37cf1e5badb0779bcbf382212189" "6d12e10b1d331dad210e47fd25d4f260802b7e77" "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" "900a4469df00ccbfd0c145c6d1e4b7953dd0afafadd7534e3a4019e8d38fc663" "ad0387b3bd8652f730ca46d25f9c170af0fd589f42e7f23f5a9e6412d97d7e56" "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e" "9d0886f8c6b389398a16257bc79780fab9831c7fc11c8ab07fa732cb7b348feade382f92617c9c5305fefba0af02ab5fd39a587d330997ff5bd0db19f7666653" "21644b72aa259e5a588cd3afbafb1d4310f4889680f6c83b9d531596a5a284f34dbebff409d23bcc86aee6bad10c891606f075c6f4755cb536da27db5693f3a7" ] diff --git a/third_party/nix/src/tests/lang/eval-okay-hashstring.nix b/third_party/nix/src/tests/lang/eval-okay-hashstring.nix deleted file mode 100644 index b0f62b245ca8..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-hashstring.nix +++ /dev/null @@ -1,4 +0,0 @@ -let - strings = [ "" "text 1" "text 2" ]; -in - builtins.concatLists (map (hash: map (builtins.hashString hash) strings) ["md5" "sha1" "sha256" "sha512"]) diff --git a/third_party/nix/src/tests/lang/eval-okay-if.exp b/third_party/nix/src/tests/lang/eval-okay-if.exp deleted file mode 100644 index 00750edc07d6..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-if.exp +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/third_party/nix/src/tests/lang/eval-okay-if.nix b/third_party/nix/src/tests/lang/eval-okay-if.nix deleted file mode 100644 index 23e4c74d5016..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-if.nix +++ /dev/null @@ -1 +0,0 @@ -if "foo" != "f" + "oo" then 1 else if false then 2 else 3 diff --git a/third_party/nix/src/tests/lang/eval-okay-import.exp b/third_party/nix/src/tests/lang/eval-okay-import.exp deleted file mode 100644 index c508125b55be..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-import.exp +++ /dev/null @@ -1 +0,0 @@ -[ 1 2 3 4 5 6 7 8 9 10 ] diff --git a/third_party/nix/src/tests/lang/eval-okay-import.nix b/third_party/nix/src/tests/lang/eval-okay-import.nix deleted file mode 100644 index 0b18d9413122..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-import.nix +++ /dev/null @@ -1,11 +0,0 @@ -let - - overrides = { - import = fn: scopedImport overrides fn; - - scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; - - builtins = builtins // overrides; - } // import ./lib.nix; - -in scopedImport overrides ./imported.nix diff --git a/third_party/nix/src/tests/lang/eval-okay-ind-string.exp b/third_party/nix/src/tests/lang/eval-okay-ind-string.exp deleted file mode 100644 index 9cf4bd2ee78a..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-ind-string.exp +++ /dev/null @@ -1 +0,0 @@ -"This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\nIf the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \nThis line is indented\na bit further.\nAnti-quotations, like so, are\nalso allowed.\n The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: '', ${.\n Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\nAlso note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. \nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\nstart on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n ln -sf 123 /var/run/opengl-driver\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=abc\nenv SLIM_THEMESDIR=def\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=foo/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=libX11/lib:libXext/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\nenv XORG_DRI_DRIVER_PATH=nvidiaDrivers/X11R6/lib/modules/drivers/ \n\nexec slim/bin/slim\nEscaping of ' followed by ': ''\nEscaping of $ followed by {: ${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\nfoo\n'bla'\nbar\ncut -d $'\\t' -f 1\nending dollar $$\n" diff --git a/third_party/nix/src/tests/lang/eval-okay-ind-string.nix b/third_party/nix/src/tests/lang/eval-okay-ind-string.nix deleted file mode 100644 index 1669dc0648ea..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-ind-string.nix +++ /dev/null @@ -1,128 +0,0 @@ -let - - s1 = '' - This is an indented multi-line string - literal. An amount of whitespace at - the start of each line matching the minimum - indentation of all lines in the string - literal together will be removed. Thus, - in this case four spaces will be - stripped from each line, even though - THIS LINE is indented six spaces. - - Also, empty lines don't count in the - determination of the indentation level (the - previous empty line has indentation 0, but - it doesn't matter). - ''; - - s2 = '' If the string starts with whitespace - followed by a newline, it's stripped, but - that's not the case here. Two spaces are - stripped because of the " " at the start. - ''; - - s3 = '' - This line is indented - a bit further. - ''; # indentation of last line doesn't count if it's empty - - s4 = '' - Anti-quotations, like ${if true then "so" else "not so"}, are - also allowed. - ''; - - s5 = '' - The \ is not special here. - ' can be followed by any character except another ', e.g. 'x'. - Likewise for $, e.g. $$ or $varName. - But ' followed by ' is special, as is $ followed by {. - If you want them, use anti-quotations: ${"''"}, ${"\${"}. - ''; - - s6 = '' - Tabs are not interpreted as whitespace (since we can't guess - what tab settings are intended), so don't use them. - This line starts with a space and a tab, so only one - space will be stripped from each line. - ''; - - s7 = '' - Also note that if the last line (just before the closing ' ') - consists only of whitespace, it's ignored. But here there is - some non-whitespace stuff, so the line isn't removed. ''; - - s8 = '' ${""} - This shows a hacky way to preserve an empty line after the start. - But there's no reason to do so: you could just repeat the empty - line. - ''; - - s9 = '' - ${""} Similarly you can force an indentation level, - in this case to 2 spaces. This works because the anti-quote - is significant (not whitespace). - ''; - - s10 = '' - ''; - - s11 = ''''; - - s12 = '' ''; - - s13 = '' - start on network-interfaces - - start script - - rm -f /var/run/opengl-driver - ${if true - then "ln -sf 123 /var/run/opengl-driver" - else if true - then "ln -sf 456 /var/run/opengl-driver" - else "" - } - - rm -f /var/log/slim.log - - end script - - env SLIM_CFGFILE=${"abc"} - env SLIM_THEMESDIR=${"def"} - env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup - env XKB_BINDIR=${"foo"}/bin # Needed for the Xkb extension. - env LD_LIBRARY_PATH=${"libX11"}/lib:${"libXext"}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz) - - ${if true - then "env XORG_DRI_DRIVER_PATH=${"nvidiaDrivers"}/X11R6/lib/modules/drivers/" - else if true - then "env XORG_DRI_DRIVER_PATH=${"mesa"}/lib/modules/dri" - else "" - } - - exec ${"slim"}/bin/slim - ''; - - s14 = '' - Escaping of ' followed by ': ''' - Escaping of $ followed by {: ''${ - And finally to interpret \n etc. as in a string: ''\n, ''\r, ''\t. - ''; - - # Regression test: antiquotation in '${x}' should work, but didn't. - s15 = let x = "bla"; in '' - foo - '${x}' - bar - ''; - - # Regression test: accept $'. - s16 = '' - cut -d $'\t' -f 1 - ''; - - # Accept dollars at end of strings - s17 = ''ending dollar $'' + ''$'' + "\n"; - -in s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15 + s16 + s17 diff --git a/third_party/nix/src/tests/lang/eval-okay-let.exp b/third_party/nix/src/tests/lang/eval-okay-let.exp deleted file mode 100644 index 14e24d419005..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-let.exp +++ /dev/null @@ -1 +0,0 @@ -"foobar" diff --git a/third_party/nix/src/tests/lang/eval-okay-let.nix b/third_party/nix/src/tests/lang/eval-okay-let.nix deleted file mode 100644 index fe118c5282e3..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-let.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - x = "foo"; - y = "bar"; - body = x + y; -} diff --git a/third_party/nix/src/tests/lang/eval-okay-list.exp b/third_party/nix/src/tests/lang/eval-okay-list.exp deleted file mode 100644 index f784f26d83f4..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-list.exp +++ /dev/null @@ -1 +0,0 @@ -"foobarblatest" diff --git a/third_party/nix/src/tests/lang/eval-okay-list.nix b/third_party/nix/src/tests/lang/eval-okay-list.nix deleted file mode 100644 index d433bcf908ba..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-list.nix +++ /dev/null @@ -1,7 +0,0 @@ -with import ./lib.nix; - -let { - - body = concat ["foo" "bar" "bla" "test"]; - -} \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/eval-okay-listtoattrs.exp b/third_party/nix/src/tests/lang/eval-okay-listtoattrs.exp deleted file mode 100644 index 74abef7bc6ed..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-listtoattrs.exp +++ /dev/null @@ -1 +0,0 @@ -"AAbar" diff --git a/third_party/nix/src/tests/lang/eval-okay-listtoattrs.nix b/third_party/nix/src/tests/lang/eval-okay-listtoattrs.nix deleted file mode 100644 index 4186e029b538..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-listtoattrs.nix +++ /dev/null @@ -1,11 +0,0 @@ -# this test shows how to use listToAttrs and that evaluation is still lazy (throw isn't called) -with import ./lib.nix; - -let - asi = name: value : { inherit name value; }; - list = [ ( asi "a" "A" ) ( asi "b" "B" ) ]; - a = builtins.listToAttrs list; - b = builtins.listToAttrs ( list ++ list ); - r = builtins.listToAttrs [ (asi "result" [ a b ]) ( asi "throw" (throw "this should not be thrown")) ]; - x = builtins.listToAttrs [ (asi "foo" "bar") (asi "foo" "bla") ]; -in concat (map (x: x.a) r.result) + x.foo diff --git a/third_party/nix/src/tests/lang/eval-okay-logic.exp b/third_party/nix/src/tests/lang/eval-okay-logic.exp deleted file mode 100644 index d00491fd7e5b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-logic.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/third_party/nix/src/tests/lang/eval-okay-logic.nix b/third_party/nix/src/tests/lang/eval-okay-logic.nix deleted file mode 100644 index fbb12794401f..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-logic.nix +++ /dev/null @@ -1 +0,0 @@ -assert !false && (true || false) -> true; 1 diff --git a/third_party/nix/src/tests/lang/eval-okay-map.exp b/third_party/nix/src/tests/lang/eval-okay-map.exp deleted file mode 100644 index dbb64f717b96..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-map.exp +++ /dev/null @@ -1 +0,0 @@ -"foobarblabarxyzzybar" diff --git a/third_party/nix/src/tests/lang/eval-okay-map.nix b/third_party/nix/src/tests/lang/eval-okay-map.nix deleted file mode 100644 index a76c1d811454..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-map.nix +++ /dev/null @@ -1,3 +0,0 @@ -with import ./lib.nix; - -concat (map (x: x + "bar") [ "foo" "bla" "xyzzy" ]) \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/eval-okay-mapattrs.exp b/third_party/nix/src/tests/lang/eval-okay-mapattrs.exp deleted file mode 100644 index 3f113f17bab1..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-mapattrs.exp +++ /dev/null @@ -1 +0,0 @@ -{ x = "x-foo"; y = "y-bar"; } diff --git a/third_party/nix/src/tests/lang/eval-okay-mapattrs.nix b/third_party/nix/src/tests/lang/eval-okay-mapattrs.nix deleted file mode 100644 index f075b6275e5a..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-mapattrs.nix +++ /dev/null @@ -1,3 +0,0 @@ -with import ./lib.nix; - -builtins.mapAttrs (name: value: name + "-" + value) { x = "foo"; y = "bar"; } diff --git a/third_party/nix/src/tests/lang/eval-okay-nested-with.exp b/third_party/nix/src/tests/lang/eval-okay-nested-with.exp deleted file mode 100644 index 0cfbf08886fc..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-nested-with.exp +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/third_party/nix/src/tests/lang/eval-okay-nested-with.nix b/third_party/nix/src/tests/lang/eval-okay-nested-with.nix deleted file mode 100644 index ba9d79aa79b1..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-nested-with.nix +++ /dev/null @@ -1,3 +0,0 @@ -with { x = 1; }; -with { x = 2; }; -x diff --git a/third_party/nix/src/tests/lang/eval-okay-new-let.exp b/third_party/nix/src/tests/lang/eval-okay-new-let.exp deleted file mode 100644 index f98b388071c2..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-new-let.exp +++ /dev/null @@ -1 +0,0 @@ -"xyzzyfoobar" diff --git a/third_party/nix/src/tests/lang/eval-okay-new-let.nix b/third_party/nix/src/tests/lang/eval-okay-new-let.nix deleted file mode 100644 index 738123141508..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-new-let.nix +++ /dev/null @@ -1,14 +0,0 @@ -let - - f = z: - - let - x = "foo"; - y = "bar"; - body = 1; # compat test - in - z + x + y; - - arg = "xyzzy"; - -in f arg diff --git a/third_party/nix/src/tests/lang/eval-okay-null-dynamic-attrs.exp b/third_party/nix/src/tests/lang/eval-okay-null-dynamic-attrs.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-null-dynamic-attrs.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-null-dynamic-attrs.nix b/third_party/nix/src/tests/lang/eval-okay-null-dynamic-attrs.nix deleted file mode 100644 index b060c0bc9850..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-null-dynamic-attrs.nix +++ /dev/null @@ -1 +0,0 @@ -{ ${null} = true; } == {} diff --git a/third_party/nix/src/tests/lang/eval-okay-partition.exp b/third_party/nix/src/tests/lang/eval-okay-partition.exp deleted file mode 100644 index cd8b8b020c05..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-partition.exp +++ /dev/null @@ -1 +0,0 @@ -{ right = [ 0 2 4 6 8 10 100 102 104 106 108 110 ]; wrong = [ 1 3 5 7 9 101 103 105 107 109 ]; } diff --git a/third_party/nix/src/tests/lang/eval-okay-partition.nix b/third_party/nix/src/tests/lang/eval-okay-partition.nix deleted file mode 100644 index 846d2ce49486..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-partition.nix +++ /dev/null @@ -1,5 +0,0 @@ -with import ./lib.nix; - -builtins.partition - (x: x / 2 * 2 == x) - (builtins.concatLists [ (range 0 10) (range 100 110) ]) diff --git a/third_party/nix/src/tests/lang/eval-okay-pathexists.exp b/third_party/nix/src/tests/lang/eval-okay-pathexists.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-pathexists.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-pathexists.nix b/third_party/nix/src/tests/lang/eval-okay-pathexists.nix deleted file mode 100644 index 50c28ee0cd30..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-pathexists.nix +++ /dev/null @@ -1,5 +0,0 @@ -builtins.pathExists (builtins.toPath ./lib.nix) -&& builtins.pathExists (builtins.toPath (builtins.toString ./lib.nix)) -&& !builtins.pathExists (builtins.toPath (builtins.toString ./bla.nix)) -&& builtins.pathExists ./lib.nix -&& !builtins.pathExists ./bla.nix diff --git a/third_party/nix/src/tests/lang/eval-okay-patterns.exp b/third_party/nix/src/tests/lang/eval-okay-patterns.exp deleted file mode 100644 index a4304010fe80..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-patterns.exp +++ /dev/null @@ -1 +0,0 @@ -"abcxyzDDDDEFijk" diff --git a/third_party/nix/src/tests/lang/eval-okay-patterns.nix b/third_party/nix/src/tests/lang/eval-okay-patterns.nix deleted file mode 100644 index 96fd25a01517..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-patterns.nix +++ /dev/null @@ -1,16 +0,0 @@ -let - - f = args@{x, y, z}: x + args.y + z; - - g = {x, y, z}@args: f args; - - h = {x ? "d", y ? x, z ? args.x}@args: x + y + z; - - j = {x, y, z, ...}: x + y + z; - -in - f {x = "a"; y = "b"; z = "c";} + - g {x = "x"; y = "y"; z = "z";} + - h {x = "D";} + - h {x = "D"; y = "E"; z = "F";} + - j {x = "i"; y = "j"; z = "k"; bla = "bla"; foo = "bar";} diff --git a/third_party/nix/src/tests/lang/eval-okay-readDir.exp b/third_party/nix/src/tests/lang/eval-okay-readDir.exp deleted file mode 100644 index bf8d2c14ea4f..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-readDir.exp +++ /dev/null @@ -1 +0,0 @@ -{ bar = "regular"; foo = "directory"; } diff --git a/third_party/nix/src/tests/lang/eval-okay-readDir.nix b/third_party/nix/src/tests/lang/eval-okay-readDir.nix deleted file mode 100644 index a7ec9292aae2..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-readDir.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.readDir ./readDir diff --git a/third_party/nix/src/tests/lang/eval-okay-readfile.exp b/third_party/nix/src/tests/lang/eval-okay-readfile.exp deleted file mode 100644 index a2c87d0c439f..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-readfile.exp +++ /dev/null @@ -1 +0,0 @@ -"builtins.readFile ./eval-okay-readfile.nix\n" diff --git a/third_party/nix/src/tests/lang/eval-okay-readfile.nix b/third_party/nix/src/tests/lang/eval-okay-readfile.nix deleted file mode 100644 index 82f7cb17435a..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-readfile.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.readFile ./eval-okay-readfile.nix diff --git a/third_party/nix/src/tests/lang/eval-okay-redefine-builtin.exp b/third_party/nix/src/tests/lang/eval-okay-redefine-builtin.exp deleted file mode 100644 index c508d5366f70..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-redefine-builtin.exp +++ /dev/null @@ -1 +0,0 @@ -false diff --git a/third_party/nix/src/tests/lang/eval-okay-redefine-builtin.nix b/third_party/nix/src/tests/lang/eval-okay-redefine-builtin.nix deleted file mode 100644 index df9fc3f37d22..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-redefine-builtin.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - throw = abort "Error!"; -in (builtins.tryEval <foobaz>).success diff --git a/third_party/nix/src/tests/lang/eval-okay-regex-match.exp b/third_party/nix/src/tests/lang/eval-okay-regex-match.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-regex-match.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-regex-match.nix b/third_party/nix/src/tests/lang/eval-okay-regex-match.nix deleted file mode 100644 index 273e2590713e..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-regex-match.nix +++ /dev/null @@ -1,29 +0,0 @@ -with builtins; - -let - - matches = pat: s: match pat s != null; - - splitFN = match "((.*)/)?([^/]*)\\.(nix|cc)"; - -in - -assert matches "foobar" "foobar"; -assert matches "fo*" "f"; -assert !matches "fo+" "f"; -assert matches "fo*" "fo"; -assert matches "fo*" "foo"; -assert matches "fo+" "foo"; -assert matches "fo{1,2}" "foo"; -assert !matches "fo{1,2}" "fooo"; -assert !matches "fo*" "foobar"; -assert matches "[[:space:]]+([^[:space:]]+)[[:space:]]+" " foo "; -assert !matches "[[:space:]]+([[:upper:]]+)[[:space:]]+" " foo "; - -assert match "(.*)\\.nix" "foobar.nix" == [ "foobar" ]; -assert match "[[:space:]]+([[:upper:]]+)[[:space:]]+" " FOO " == [ "FOO" ]; - -assert splitFN "/path/to/foobar.nix" == [ "/path/to/" "/path/to" "foobar" "nix" ]; -assert splitFN "foobar.cc" == [ null null "foobar" "cc" ]; - -true diff --git a/third_party/nix/src/tests/lang/eval-okay-regex-split.exp b/third_party/nix/src/tests/lang/eval-okay-regex-split.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-regex-split.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-regex-split.nix b/third_party/nix/src/tests/lang/eval-okay-regex-split.nix deleted file mode 100644 index 0073e057787d..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-regex-split.nix +++ /dev/null @@ -1,48 +0,0 @@ -with builtins; - -# Non capturing regex returns empty lists -assert split "foobar" "foobar" == ["" [] ""]; -assert split "fo*" "f" == ["" [] ""]; -assert split "fo+" "f" == ["f"]; -assert split "fo*" "fo" == ["" [] ""]; -assert split "fo*" "foo" == ["" [] ""]; -assert split "fo+" "foo" == ["" [] ""]; -assert split "fo{1,2}" "foo" == ["" [] ""]; -assert split "fo{1,2}" "fooo" == ["" [] "o"]; -assert split "fo*" "foobar" == ["" [] "bar"]; - -# Capturing regex returns a list of sub-matches -assert split "(fo*)" "f" == ["" ["f"] ""]; -assert split "(fo+)" "f" == ["f"]; -assert split "(fo*)" "fo" == ["" ["fo"] ""]; -assert split "(f)(o*)" "f" == ["" ["f" ""] ""]; -assert split "(f)(o*)" "foo" == ["" ["f" "oo"] ""]; -assert split "(fo+)" "foo" == ["" ["foo"] ""]; -assert split "(fo{1,2})" "foo" == ["" ["foo"] ""]; -assert split "(fo{1,2})" "fooo" == ["" ["foo"] "o"]; -assert split "(fo*)" "foobar" == ["" ["foo"] "bar"]; - -# Matches are greedy. -assert split "(o+)" "oooofoooo" == ["" ["oooo"] "f" ["oooo"] ""]; - -# Matches multiple times. -assert split "(b)" "foobarbaz" == ["foo" ["b"] "ar" ["b"] "az"]; - -# Split large strings containing newlines. null are inserted when a -# pattern within the current did not match anything. -assert split "[[:space:]]+|([',.!?])" '' - Nix Rocks! - That's why I use it. -'' == [ - "Nix" [ null ] "Rocks" ["!"] "" [ null ] - "That" ["'"] "s" [ null ] "why" [ null ] "I" [ null ] "use" [ null ] "it" ["."] "" [ null ] - "" -]; - -# Documentation examples -assert split "(a)b" "abc" == [ "" [ "a" ] "c" ]; -assert split "([ac])" "abc" == [ "" [ "a" ] "b" [ "c" ] "" ]; -assert split "(a)|(c)" "abc" == [ "" [ "a" null ] "b" [ null "c" ] "" ]; -assert split "([[:upper:]]+)" " FOO " == [ " " [ "FOO" ] " " ]; - -true diff --git a/third_party/nix/src/tests/lang/eval-okay-remove.exp b/third_party/nix/src/tests/lang/eval-okay-remove.exp deleted file mode 100644 index 8d38505c1686..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-remove.exp +++ /dev/null @@ -1 +0,0 @@ -456 diff --git a/third_party/nix/src/tests/lang/eval-okay-remove.nix b/third_party/nix/src/tests/lang/eval-okay-remove.nix deleted file mode 100644 index 4ad5ba897fa7..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-remove.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - attrs = {x = 123; y = 456;}; - - body = (removeAttrs attrs ["x"]).y; -} \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/eval-okay-replacestrings.exp b/third_party/nix/src/tests/lang/eval-okay-replacestrings.exp deleted file mode 100644 index 72e8274d8c58..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-replacestrings.exp +++ /dev/null @@ -1 +0,0 @@ -[ "faabar" "fbar" "fubar" "faboor" "fubar" "XaXbXcX" "X" "a_b" ] diff --git a/third_party/nix/src/tests/lang/eval-okay-replacestrings.nix b/third_party/nix/src/tests/lang/eval-okay-replacestrings.nix deleted file mode 100644 index bd8031fc004e..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-replacestrings.nix +++ /dev/null @@ -1,11 +0,0 @@ -with builtins; - -[ (replaceStrings ["o"] ["a"] "foobar") - (replaceStrings ["o"] [""] "foobar") - (replaceStrings ["oo"] ["u"] "foobar") - (replaceStrings ["oo" "a"] ["a" "oo"] "foobar") - (replaceStrings ["oo" "oo"] ["u" "i"] "foobar") - (replaceStrings [""] ["X"] "abc") - (replaceStrings [""] ["X"] "") - (replaceStrings ["-"] ["_"] "a-b") -] diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-1.exp b/third_party/nix/src/tests/lang/eval-okay-scope-1.exp deleted file mode 100644 index 00750edc07d6..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-1.exp +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-1.nix b/third_party/nix/src/tests/lang/eval-okay-scope-1.nix deleted file mode 100644 index fa38a7174e03..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-1.nix +++ /dev/null @@ -1,6 +0,0 @@ -(({x}: x: - - { x = 1; - y = x; - } -) {x = 2;} 3).y diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-2.exp b/third_party/nix/src/tests/lang/eval-okay-scope-2.exp deleted file mode 100644 index d00491fd7e5b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-2.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-2.nix b/third_party/nix/src/tests/lang/eval-okay-scope-2.nix deleted file mode 100644 index eb8b02bc4994..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-2.nix +++ /dev/null @@ -1,6 +0,0 @@ -((x: {x}: - rec { - x = 1; - y = x; - } -) 2 {x = 3;}).y diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-3.exp b/third_party/nix/src/tests/lang/eval-okay-scope-3.exp deleted file mode 100644 index b8626c4cff28..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-3.exp +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-3.nix b/third_party/nix/src/tests/lang/eval-okay-scope-3.nix deleted file mode 100644 index 10d6bc04d830..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-3.nix +++ /dev/null @@ -1,6 +0,0 @@ -((x: as: {x}: - rec { - inherit (as) x; - y = x; - } -) 2 {x = 4;} {x = 3;}).y diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-4.exp b/third_party/nix/src/tests/lang/eval-okay-scope-4.exp deleted file mode 100644 index 00ff03a46c9b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-4.exp +++ /dev/null @@ -1 +0,0 @@ -"ccdd" diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-4.nix b/third_party/nix/src/tests/lang/eval-okay-scope-4.nix deleted file mode 100644 index dc8243bc8546..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-4.nix +++ /dev/null @@ -1,10 +0,0 @@ -let { - - x = "a"; - y = "b"; - - f = {x ? y, y ? x}: x + y; - - body = f {x = "c";} + f {y = "d";}; - -} diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-6.exp b/third_party/nix/src/tests/lang/eval-okay-scope-6.exp deleted file mode 100644 index 00ff03a46c9b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-6.exp +++ /dev/null @@ -1 +0,0 @@ -"ccdd" diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-6.nix b/third_party/nix/src/tests/lang/eval-okay-scope-6.nix deleted file mode 100644 index 0995d4e7e7e0..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-6.nix +++ /dev/null @@ -1,7 +0,0 @@ -let { - - f = {x ? y, y ? x}: x + y; - - body = f {x = "c";} + f {y = "d";}; - -} diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-7.exp b/third_party/nix/src/tests/lang/eval-okay-scope-7.exp deleted file mode 100644 index d00491fd7e5b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-7.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/third_party/nix/src/tests/lang/eval-okay-scope-7.nix b/third_party/nix/src/tests/lang/eval-okay-scope-7.nix deleted file mode 100644 index 4da02968f6b7..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-scope-7.nix +++ /dev/null @@ -1,6 +0,0 @@ -rec { - inherit (x) y; - x = { - y = 1; - }; -}.y diff --git a/third_party/nix/src/tests/lang/eval-okay-seq.exp b/third_party/nix/src/tests/lang/eval-okay-seq.exp deleted file mode 100644 index 0cfbf08886fc..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-seq.exp +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/third_party/nix/src/tests/lang/eval-okay-seq.nix b/third_party/nix/src/tests/lang/eval-okay-seq.nix deleted file mode 100644 index 0a9a21c03b62..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-seq.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.seq 1 2 diff --git a/third_party/nix/src/tests/lang/eval-okay-sort.exp b/third_party/nix/src/tests/lang/eval-okay-sort.exp deleted file mode 100644 index 148b93516394..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-sort.exp +++ /dev/null @@ -1 +0,0 @@ -[ [ 42 77 147 249 483 526 ] [ 526 483 249 147 77 42 ] [ "bar" "fnord" "foo" "xyzzy" ] [ { key = 1; value = "foo"; } { key = 1; value = "fnord"; } { key = 2; value = "bar"; } ] ] diff --git a/third_party/nix/src/tests/lang/eval-okay-sort.nix b/third_party/nix/src/tests/lang/eval-okay-sort.nix deleted file mode 100644 index 8299c3a4a3aa..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-sort.nix +++ /dev/null @@ -1,8 +0,0 @@ -with builtins; - -[ (sort lessThan [ 483 249 526 147 42 77 ]) - (sort (x: y: y < x) [ 483 249 526 147 42 77 ]) - (sort lessThan [ "foo" "bar" "xyzzy" "fnord" ]) - (sort (x: y: x.key < y.key) - [ { key = 1; value = "foo"; } { key = 2; value = "bar"; } { key = 1; value = "fnord"; } ]) -] diff --git a/third_party/nix/src/tests/lang/eval-okay-splitversion.exp b/third_party/nix/src/tests/lang/eval-okay-splitversion.exp deleted file mode 100644 index 153ceb8186a0..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-splitversion.exp +++ /dev/null @@ -1 +0,0 @@ -[ "1" "2" "3" ] diff --git a/third_party/nix/src/tests/lang/eval-okay-splitversion.nix b/third_party/nix/src/tests/lang/eval-okay-splitversion.nix deleted file mode 100644 index 9e5c99d2e7f6..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-splitversion.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.splitVersion "1.2.3" diff --git a/third_party/nix/src/tests/lang/eval-okay-string.exp b/third_party/nix/src/tests/lang/eval-okay-string.exp deleted file mode 100644 index 63f650f73a3a..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-string.exp +++ /dev/null @@ -1 +0,0 @@ -"foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar$\"$\"$" diff --git a/third_party/nix/src/tests/lang/eval-okay-string.nix b/third_party/nix/src/tests/lang/eval-okay-string.nix deleted file mode 100644 index 47cc989ad46a..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-string.nix +++ /dev/null @@ -1,12 +0,0 @@ -"foo" + "bar" - + toString (/a/b + /c/d) - + toString (/foo/bar + "/../xyzzy/." + "/foo.txt") - + ("/../foo" + toString /x/y) - + "escape: \"quote\" \n \\" - + "end -of -line" - + "foo${if true then "b${"a" + "r"}" else "xyzzy"}blaat" - + "foo$bar" - + "$\"$\"" - + "$" diff --git a/third_party/nix/src/tests/lang/eval-okay-strings-as-attrs-names.exp b/third_party/nix/src/tests/lang/eval-okay-strings-as-attrs-names.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-strings-as-attrs-names.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-strings-as-attrs-names.nix b/third_party/nix/src/tests/lang/eval-okay-strings-as-attrs-names.nix deleted file mode 100644 index 5e40928dbe31..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-strings-as-attrs-names.nix +++ /dev/null @@ -1,20 +0,0 @@ -let - - attr = { - "key 1" = "test"; - "key 2" = "caseok"; - }; - - t1 = builtins.getAttr "key 1" attr; - t2 = attr."key 2"; - t3 = attr ? "key 1"; - t4 = builtins.attrNames { inherit (attr) "key 1"; }; - - # This is permitted, but there is currently no way to reference this - # variable. - "foo bar" = 1; - -in t1 == "test" - && t2 == "caseok" - && t3 == true - && t4 == ["key 1"] diff --git a/third_party/nix/src/tests/lang/eval-okay-substring.exp b/third_party/nix/src/tests/lang/eval-okay-substring.exp deleted file mode 100644 index 6aace04b0f57..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-substring.exp +++ /dev/null @@ -1 +0,0 @@ -"ooxfoobarybarzobaabbc" diff --git a/third_party/nix/src/tests/lang/eval-okay-substring.nix b/third_party/nix/src/tests/lang/eval-okay-substring.nix deleted file mode 100644 index 424af00d9b3b..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-substring.nix +++ /dev/null @@ -1,21 +0,0 @@ -with builtins; - -let - - s = "foobar"; - -in - -substring 1 2 s -+ "x" -+ substring 0 (stringLength s) s -+ "y" -+ substring 3 100 s -+ "z" -+ substring 2 (sub (stringLength s) 3) s -+ "a" -+ substring 3 0 s -+ "b" -+ substring 3 1 s -+ "c" -+ substring 5 10 "perl" diff --git a/third_party/nix/src/tests/lang/eval-okay-tail-call-1.exp-disabled b/third_party/nix/src/tests/lang/eval-okay-tail-call-1.exp-disabled deleted file mode 100644 index f7393e847d34..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-tail-call-1.exp-disabled +++ /dev/null @@ -1 +0,0 @@ -100000 diff --git a/third_party/nix/src/tests/lang/eval-okay-tojson.exp b/third_party/nix/src/tests/lang/eval-okay-tojson.exp deleted file mode 100644 index e92aae3235f2..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-tojson.exp +++ /dev/null @@ -1 +0,0 @@ -"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3,\"j\":1.44,\"k\":\"foo\"}" diff --git a/third_party/nix/src/tests/lang/eval-okay-tojson.nix b/third_party/nix/src/tests/lang/eval-okay-tojson.nix deleted file mode 100644 index ce67943bead5..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-tojson.nix +++ /dev/null @@ -1,13 +0,0 @@ -builtins.toJSON - { a = 123; - b = -456; - c = "foo"; - d = "foo\n\"bar\""; - e = true; - f = false; - g = [ 1 2 3 ]; - h = [ "a" [ "b" { "foo\nbar" = {}; } ] ]; - i = 1 + 2; - j = 1.44; - k = { __toString = self: self.a; a = "foo"; }; - } diff --git a/third_party/nix/src/tests/lang/eval-okay-toxml2.exp b/third_party/nix/src/tests/lang/eval-okay-toxml2.exp deleted file mode 100644 index 634a841eb190..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-toxml2.exp +++ /dev/null @@ -1 +0,0 @@ -"<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <list>\n <string value=\"ab\" />\n <int value=\"10\" />\n <attrs>\n <attr name=\"x\">\n <string value=\"x\" />\n </attr>\n <attr name=\"y\">\n <string value=\"x\" />\n </attr>\n </attrs>\n </list>\n</expr>\n" diff --git a/third_party/nix/src/tests/lang/eval-okay-toxml2.nix b/third_party/nix/src/tests/lang/eval-okay-toxml2.nix deleted file mode 100644 index ff1791b30eb5..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-toxml2.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.toXML [("a" + "b") 10 (rec {x = "x"; y = x;})] diff --git a/third_party/nix/src/tests/lang/eval-okay-tryeval.exp b/third_party/nix/src/tests/lang/eval-okay-tryeval.exp deleted file mode 100644 index 2b2e6fa711f4..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-tryeval.exp +++ /dev/null @@ -1 +0,0 @@ -{ x = { success = true; value = "x"; }; y = { success = false; value = false; }; z = { success = false; value = false; }; } diff --git a/third_party/nix/src/tests/lang/eval-okay-tryeval.nix b/third_party/nix/src/tests/lang/eval-okay-tryeval.nix deleted file mode 100644 index 629bc440a85a..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-tryeval.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - x = builtins.tryEval "x"; - y = builtins.tryEval (assert false; "y"); - z = builtins.tryEval (throw "bla"); -} diff --git a/third_party/nix/src/tests/lang/eval-okay-types.exp b/third_party/nix/src/tests/lang/eval-okay-types.exp deleted file mode 100644 index 882c16dbfe36..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-types.exp +++ /dev/null @@ -1 +0,0 @@ -[ true false true true false true false true false true true true true true true true true true true true false true true true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ] diff --git a/third_party/nix/src/tests/lang/eval-okay-types.nix b/third_party/nix/src/tests/lang/eval-okay-types.nix deleted file mode 100644 index cc51d8cb7a25..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-types.nix +++ /dev/null @@ -1,38 +0,0 @@ -with builtins; - -[ (isNull null) - (isNull (x: x)) - (isFunction (x: x)) - (isFunction functionArgs) - (isFunction "fnord") - (isString ("foo" + "bar")) - (isString [ "x" ]) - (isInt (1 + 2)) - (isInt { x = 123; }) - (isInt (1 / 2)) - (isInt (1 + 1)) - (isInt (1 / 2)) - (isInt (1 * 2)) - (isInt (1 - 2)) - (isFloat (1.2)) - (isFloat (1 + 1.0)) - (isFloat (1 / 2.0)) - (isFloat (1 * 2.0)) - (isFloat (1 - 2.0)) - (isBool (true && false)) - (isBool null) - (isPath /nix/store) - (isPath ./.) - (isAttrs { x = 123; }) - (isAttrs null) - (typeOf (3 * 4)) - (typeOf true) - (typeOf "xyzzy") - (typeOf null) - (typeOf { x = 456; }) - (typeOf [ 1 2 3 ]) - (typeOf (x: x)) - (typeOf ((x: y: x) 1)) - (typeOf map) - (typeOf (map (x: x))) -] diff --git a/third_party/nix/src/tests/lang/eval-okay-versions.exp b/third_party/nix/src/tests/lang/eval-okay-versions.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-versions.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/eval-okay-versions.nix b/third_party/nix/src/tests/lang/eval-okay-versions.nix deleted file mode 100644 index e63c36586bb6..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-versions.nix +++ /dev/null @@ -1,40 +0,0 @@ -let - - name1 = "hello-1.0.2"; - name2 = "hello"; - name3 = "915resolution-0.5.2"; - name4 = "xf86-video-i810-1.7.4"; - - eq = 0; - lt = builtins.sub 0 1; - gt = 1; - - versionTest = v1: v2: expected: - let d1 = builtins.compareVersions v1 v2; - d2 = builtins.compareVersions v2 v1; - in d1 == builtins.sub 0 d2 && d1 == expected; - - tests = [ - ((builtins.parseDrvName name1).name == "hello") - ((builtins.parseDrvName name1).version == "1.0.2") - ((builtins.parseDrvName name2).name == "hello") - ((builtins.parseDrvName name2).version == "") - ((builtins.parseDrvName name3).name == "915resolution") - ((builtins.parseDrvName name3).version == "0.5.2") - ((builtins.parseDrvName name4).name == "xf86-video-i810") - ((builtins.parseDrvName name4).version == "1.7.4") - (versionTest "1.0" "2.3" lt) - (versionTest "2.1" "2.3" lt) - (versionTest "2.3" "2.3" eq) - (versionTest "2.5" "2.3" gt) - (versionTest "3.1" "2.3" gt) - (versionTest "2.3.1" "2.3" gt) - (versionTest "2.3.1" "2.3a" gt) - (versionTest "2.3pre1" "2.3" lt) - (versionTest "2.3pre3" "2.3pre12" lt) - (versionTest "2.3a" "2.3c" lt) - (versionTest "2.3pre1" "2.3c" lt) - (versionTest "2.3pre1" "2.3q" lt) - ]; - -in (import ./lib.nix).and tests diff --git a/third_party/nix/src/tests/lang/eval-okay-with.exp b/third_party/nix/src/tests/lang/eval-okay-with.exp deleted file mode 100644 index 378c8dc80403..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-with.exp +++ /dev/null @@ -1 +0,0 @@ -"xyzzybarxyzzybar" diff --git a/third_party/nix/src/tests/lang/eval-okay-with.nix b/third_party/nix/src/tests/lang/eval-okay-with.nix deleted file mode 100644 index 033e8d3aba57..000000000000 --- a/third_party/nix/src/tests/lang/eval-okay-with.nix +++ /dev/null @@ -1,19 +0,0 @@ -let { - - a = "xyzzy"; - - as = { - a = "foo"; - b = "bar"; - }; - - bs = { - a = "bar"; - }; - - x = with as; a + b; - - y = with as; with bs; a + b; - - body = x + y; -} diff --git a/third_party/nix/src/tests/lang/evalargs-okay-autoargs.nix b/third_party/nix/src/tests/lang/evalargs-okay-autoargs.nix deleted file mode 100644 index 815f51b1d67a..000000000000 --- a/third_party/nix/src/tests/lang/evalargs-okay-autoargs.nix +++ /dev/null @@ -1,15 +0,0 @@ -let - - foobar = "foobar"; - -in - -{ xyzzy2 ? xyzzy # mutually recursive args -, xyzzy ? "blaat" # will be overridden by --argstr -, fb ? foobar -, lib # will be set by --arg -}: - -{ - result = lib.concat [xyzzy xyzzy2 fb]; -} diff --git a/third_party/nix/src/tests/lang/evalstore-okay-autoargs.exp b/third_party/nix/src/tests/lang/evalstore-okay-autoargs.exp deleted file mode 100644 index 7a8391786a09..000000000000 --- a/third_party/nix/src/tests/lang/evalstore-okay-autoargs.exp +++ /dev/null @@ -1 +0,0 @@ -"xyzzy!xyzzy!foobar" diff --git a/third_party/nix/src/tests/lang/evalstore-okay-context-introspection.exp b/third_party/nix/src/tests/lang/evalstore-okay-context-introspection.exp deleted file mode 100644 index 27ba77ddaf61..000000000000 --- a/third_party/nix/src/tests/lang/evalstore-okay-context-introspection.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/third_party/nix/src/tests/lang/evalstore-okay-context-introspection.nix b/third_party/nix/src/tests/lang/evalstore-okay-context-introspection.nix deleted file mode 100644 index d11aad38c726..000000000000 --- a/third_party/nix/src/tests/lang/evalstore-okay-context-introspection.nix +++ /dev/null @@ -1,24 +0,0 @@ -let - drv = derivation { - name = "fail"; - builder = "/bin/false"; - system = "x86_64-linux"; - outputs = [ "out" "foo" ]; - }; - - path = "${./evalstore-okay-context-introspection.nix}"; - - desired-context = { - "${builtins.unsafeDiscardStringContext path}" = { - path = true; - }; - "${builtins.unsafeDiscardStringContext drv.drvPath}" = { - outputs = [ "foo" "out" ]; - allOutputs = true; - }; - }; - - legit-context = builtins.getContext "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}"; - - constructed-context = builtins.getContext (builtins.appendContext "" desired-context); -in legit-context == constructed-context diff --git a/third_party/nix/src/tests/lang/evalstore-okay-context.exp b/third_party/nix/src/tests/lang/evalstore-okay-context.exp deleted file mode 100644 index f8088f9e172a..000000000000 --- a/third_party/nix/src/tests/lang/evalstore-okay-context.exp +++ /dev/null @@ -1 +0,0 @@ -"foo evalstore-okay-context.nix bar" diff --git a/third_party/nix/src/tests/lang/evalstore-okay-context.nix b/third_party/nix/src/tests/lang/evalstore-okay-context.nix deleted file mode 100644 index 90f82abe1c36..000000000000 --- a/third_party/nix/src/tests/lang/evalstore-okay-context.nix +++ /dev/null @@ -1,6 +0,0 @@ -let s = "foo ${builtins.substring 33 100 (baseNameOf "${./evalstore-okay-context.nix}")} bar"; -in - if s != "foo evalstore-okay-context.nix bar" - then abort "context not discarded" - else builtins.unsafeDiscardStringContext s - diff --git a/third_party/nix/src/tests/lang/evalstore-okay-toxml.exp b/third_party/nix/src/tests/lang/evalstore-okay-toxml.exp deleted file mode 100644 index 828220890ecd..000000000000 --- a/third_party/nix/src/tests/lang/evalstore-okay-toxml.exp +++ /dev/null @@ -1 +0,0 @@ -"<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <attrs>\n <attr name=\"a\">\n <string value=\"s\" />\n </attr>\n </attrs>\n</expr>\n" diff --git a/third_party/nix/src/tests/lang/evalstore-okay-toxml.nix b/third_party/nix/src/tests/lang/evalstore-okay-toxml.nix deleted file mode 100644 index 068c97a6c1b3..000000000000 --- a/third_party/nix/src/tests/lang/evalstore-okay-toxml.nix +++ /dev/null @@ -1,3 +0,0 @@ -# Make sure the expected XML output is produced; in particular, make sure it -# doesn't contain source location information. -builtins.toXML { a = "s"; } diff --git a/third_party/nix/src/tests/lang/imported.nix b/third_party/nix/src/tests/lang/imported.nix deleted file mode 100644 index fb39ee4efacd..000000000000 --- a/third_party/nix/src/tests/lang/imported.nix +++ /dev/null @@ -1,3 +0,0 @@ -# The function ‘range’ comes from lib.nix and was added to the lexical -# scope by scopedImport. -range 1 5 ++ import ./imported2.nix diff --git a/third_party/nix/src/tests/lang/imported2.nix b/third_party/nix/src/tests/lang/imported2.nix deleted file mode 100644 index 6d0a2992b732..000000000000 --- a/third_party/nix/src/tests/lang/imported2.nix +++ /dev/null @@ -1 +0,0 @@ -range 6 10 diff --git a/third_party/nix/src/tests/lang/lib.nix b/third_party/nix/src/tests/lang/lib.nix deleted file mode 100644 index 028a538314b7..000000000000 --- a/third_party/nix/src/tests/lang/lib.nix +++ /dev/null @@ -1,61 +0,0 @@ -with builtins; - -rec { - - fold = op: nul: list: - if list == [] - then nul - else op (head list) (fold op nul (tail list)); - - concat = - fold (x: y: x + y) ""; - - and = fold (x: y: x && y) true; - - flatten = x: - if isList x - then fold (x: y: (flatten x) ++ y) [] x - else [x]; - - sum = foldl' (x: y: add x y) 0; - - hasSuffix = ext: fileName: - let lenFileName = stringLength fileName; - lenExt = stringLength ext; - in !(lessThan lenFileName lenExt) && - substring (sub lenFileName lenExt) lenFileName fileName == ext; - - # Split a list at the given position. - splitAt = pos: list: - if pos == 0 then {first = []; second = list;} else - if list == [] then {first = []; second = [];} else - let res = splitAt (sub pos 1) (tail list); - in {first = [(head list)] ++ res.first; second = res.second;}; - - # Stable merge sort. - sortBy = comp: list: - if lessThan 1 (length list) - then - let - split = splitAt (div (length list) 2) list; - first = sortBy comp split.first; - second = sortBy comp split.second; - in mergeLists comp first second - else list; - - mergeLists = comp: list1: list2: - if list1 == [] then list2 else - if list2 == [] then list1 else - if comp (head list2) (head list1) then [(head list2)] ++ mergeLists comp list1 (tail list2) else - [(head list1)] ++ mergeLists comp (tail list1) list2; - - id = x: x; - - const = x: y: x; - - range = first: last: - if first > last - then [] - else genList (n: first + n) (last - first + 1); - -} diff --git a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-1.nix b/third_party/nix/src/tests/lang/parse-fail-dup-attrs-1.nix deleted file mode 100644 index e590e8a04e5a..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-1.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - x = 123; - y = 456; - x = 789; -} diff --git a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-2.nix b/third_party/nix/src/tests/lang/parse-fail-dup-attrs-2.nix deleted file mode 100644 index 864d9865e07d..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-2.nix +++ /dev/null @@ -1,13 +0,0 @@ -let { - - as = { - x = 123; - y = 456; - }; - - bs = { - x = 789; - inherit (as) x; - }; - -} diff --git a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-3.nix b/third_party/nix/src/tests/lang/parse-fail-dup-attrs-3.nix deleted file mode 100644 index 114d19779f86..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-3.nix +++ /dev/null @@ -1,13 +0,0 @@ -let { - - as = { - x = 123; - y = 456; - }; - - bs = rec { - x = 789; - inherit (as) x; - }; - -} diff --git a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-4.nix b/third_party/nix/src/tests/lang/parse-fail-dup-attrs-4.nix deleted file mode 100644 index 77417432b347..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-4.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - services.ssh.port = 22; - services.ssh.port = 23; -} diff --git a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-7.nix b/third_party/nix/src/tests/lang/parse-fail-dup-attrs-7.nix deleted file mode 100644 index bbc3eb08c0f6..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-dup-attrs-7.nix +++ /dev/null @@ -1,9 +0,0 @@ -rec { - - x = 1; - - as = { - inherit x; - inherit x; - }; -} \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/parse-fail-dup-formals.nix b/third_party/nix/src/tests/lang/parse-fail-dup-formals.nix deleted file mode 100644 index a0edd91a9666..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-dup-formals.nix +++ /dev/null @@ -1 +0,0 @@ -{x, y, x}: x \ No newline at end of file diff --git a/third_party/nix/src/tests/lang/parse-fail-mixed-nested-attrs1.nix b/third_party/nix/src/tests/lang/parse-fail-mixed-nested-attrs1.nix deleted file mode 100644 index 11e40e66fd1b..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-mixed-nested-attrs1.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - x.z = 3; - x = { y = 3; z = 3; }; -} diff --git a/third_party/nix/src/tests/lang/parse-fail-mixed-nested-attrs2.nix b/third_party/nix/src/tests/lang/parse-fail-mixed-nested-attrs2.nix deleted file mode 100644 index 17da82e5f0c7..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-mixed-nested-attrs2.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - x.y.y = 3; - x = { y.y= 3; z = 3; }; -} diff --git a/third_party/nix/src/tests/lang/parse-fail-path-slash.nix b/third_party/nix/src/tests/lang/parse-fail-path-slash.nix deleted file mode 100644 index 8c2e104c788f..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-path-slash.nix +++ /dev/null @@ -1,6 +0,0 @@ -# Trailing slashes in paths are not allowed. -# This restriction could be lifted sometime, -# for example if we make '/' a path concatenation operator. -# See https://github.com/NixOS/nix/issues/1138 -# and https://nixos.org/nix-dev/2016-June/020829.html -/nix/store/ diff --git a/third_party/nix/src/tests/lang/parse-fail-patterns-1.nix b/third_party/nix/src/tests/lang/parse-fail-patterns-1.nix deleted file mode 100644 index 7b40616417b8..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-patterns-1.nix +++ /dev/null @@ -1 +0,0 @@ -args@{args, x, y, z}: x diff --git a/third_party/nix/src/tests/lang/parse-fail-regression-20060610.nix b/third_party/nix/src/tests/lang/parse-fail-regression-20060610.nix deleted file mode 100644 index b1934f7e1e82..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-regression-20060610.nix +++ /dev/null @@ -1,11 +0,0 @@ -let { - x = - {gcc}: - { - inherit gcc; - }; - - body = ({ - inherit gcc; - }).gcc; -} diff --git a/third_party/nix/src/tests/lang/parse-fail-uft8.nix b/third_party/nix/src/tests/lang/parse-fail-uft8.nix deleted file mode 100644 index 34948d48aed2..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-uft8.nix +++ /dev/null @@ -1 +0,0 @@ -123 é 4 diff --git a/third_party/nix/src/tests/lang/parse-fail-undef-var-2.nix b/third_party/nix/src/tests/lang/parse-fail-undef-var-2.nix deleted file mode 100644 index c10a52b1ea42..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-undef-var-2.nix +++ /dev/null @@ -1,7 +0,0 @@ -let { - - f = {x, y : ["baz" "bar" z "bat"]}: x + y; - - body = f {x = "foo"; y = "bar";}; - -} diff --git a/third_party/nix/src/tests/lang/parse-fail-undef-var.nix b/third_party/nix/src/tests/lang/parse-fail-undef-var.nix deleted file mode 100644 index 7b63008110db..000000000000 --- a/third_party/nix/src/tests/lang/parse-fail-undef-var.nix +++ /dev/null @@ -1 +0,0 @@ -x: y diff --git a/third_party/nix/src/tests/lang/parse-okay-1.nix b/third_party/nix/src/tests/lang/parse-okay-1.nix deleted file mode 100644 index 23a58ed109b1..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-1.nix +++ /dev/null @@ -1 +0,0 @@ -{x, y, z}: x + y + z diff --git a/third_party/nix/src/tests/lang/parse-okay-crlf.nix b/third_party/nix/src/tests/lang/parse-okay-crlf.nix deleted file mode 100644 index 21518d4c6d80..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-crlf.nix +++ /dev/null @@ -1,17 +0,0 @@ -rec { - - /* Dit is - een test. */ - - x = - # Dit is een test. y; - - y = 123; - - # CR or CR/LF (but not explicit \r's) in strings should be - # translated to LF. - foo = "multi line - string - test\r"; - - z = 456; } diff --git a/third_party/nix/src/tests/lang/parse-okay-dup-attrs-5.nix b/third_party/nix/src/tests/lang/parse-okay-dup-attrs-5.nix deleted file mode 100644 index f4b9efd0c596..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-dup-attrs-5.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - services.ssh = { enable = true; }; - services.ssh.port = 23; -} diff --git a/third_party/nix/src/tests/lang/parse-okay-dup-attrs-6.nix b/third_party/nix/src/tests/lang/parse-okay-dup-attrs-6.nix deleted file mode 100644 index ae6d7a769305..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-dup-attrs-6.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - services.ssh.port = 23; - services.ssh = { enable = true; }; -} diff --git a/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-1.nix b/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-1.nix deleted file mode 100644 index fd1001c8cafc..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-1.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - x = { y = 3; z = 3; }; - x.q = 3; -} diff --git a/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-2.nix b/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-2.nix deleted file mode 100644 index ad066b680384..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-2.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - x.q = 3; - x = { y = 3; z = 3; }; -} diff --git a/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-3.nix b/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-3.nix deleted file mode 100644 index 45a33e480373..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-mixed-nested-attrs-3.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - services.ssh.enable = true; - services.ssh = { port = 123; }; - services = { - httpd.enable = true; - }; -} diff --git a/third_party/nix/src/tests/lang/parse-okay-regression-20041027.nix b/third_party/nix/src/tests/lang/parse-okay-regression-20041027.nix deleted file mode 100644 index ae2e256eeaaa..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-regression-20041027.nix +++ /dev/null @@ -1,11 +0,0 @@ -{stdenv, fetchurl /* pkgconfig, libX11 */ }: - -stdenv.mkDerivation { - name = "libXi-6.0.1"; - src = fetchurl { - url = http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2; - md5 = "7e935a42428d63a387b3c048be0f2756"; - }; -/* buildInputs = [pkgconfig]; - propagatedBuildInputs = [libX11]; */ -} diff --git a/third_party/nix/src/tests/lang/parse-okay-regression-751.nix b/third_party/nix/src/tests/lang/parse-okay-regression-751.nix deleted file mode 100644 index 05c78b3016d3..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-regression-751.nix +++ /dev/null @@ -1,2 +0,0 @@ -let const = a: "const"; in -''${ const { x = "q"; }}'' diff --git a/third_party/nix/src/tests/lang/parse-okay-subversion.nix b/third_party/nix/src/tests/lang/parse-okay-subversion.nix deleted file mode 100644 index 356272815d26..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-subversion.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ localServer ? false -, httpServer ? false -, sslSupport ? false -, pythonBindings ? false -, javaSwigBindings ? false -, javahlBindings ? false -, stdenv, fetchurl -, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null -}: - -assert expat != null; -assert localServer -> db4 != null; -assert httpServer -> httpd != null && httpd.expat == expat; -assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); -assert pythonBindings -> swig != null && swig.pythonSupport; -assert javaSwigBindings -> swig != null && swig.javaSupport; -assert javahlBindings -> j2sdk != null; - -stdenv.mkDerivation { - name = "subversion-1.1.1"; - - builder = /foo/bar; - src = fetchurl { - url = http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2; - md5 = "a180c3fe91680389c210c99def54d9e0"; - }; - - # This is a hopefully temporary fix for the problem that - # libsvnjavahl.so isn't linked against libstdc++, which causes - # loading the library into the JVM to fail. - patches = if javahlBindings then [/javahl.patch] else []; - - openssl = if sslSupport then openssl else null; - httpd = if httpServer then httpd else null; - db4 = if localServer then db4 else null; - swig = if pythonBindings || javaSwigBindings then swig else null; - python = if pythonBindings then swig.python else null; - j2sdk = if javaSwigBindings then swig.j2sdk else - if javahlBindings then j2sdk else null; - - inherit expat localServer httpServer sslSupport - pythonBindings javaSwigBindings javahlBindings; -} diff --git a/third_party/nix/src/tests/lang/parse-okay-url.nix b/third_party/nix/src/tests/lang/parse-okay-url.nix deleted file mode 100644 index fce3b13ee64b..000000000000 --- a/third_party/nix/src/tests/lang/parse-okay-url.nix +++ /dev/null @@ -1,7 +0,0 @@ -[ x:x - https://svn.cs.uu.nl:12443/repos/trace/trunk - http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2 - http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz - http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz - ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz -] diff --git a/third_party/nix/src/tests/lang/readDir/bar b/third_party/nix/src/tests/lang/readDir/bar deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/third_party/nix/src/tests/lang/readDir/bar +++ /dev/null diff --git a/third_party/nix/src/tests/lang/readDir/foo/git-hates-directories b/third_party/nix/src/tests/lang/readDir/foo/git-hates-directories deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/third_party/nix/src/tests/lang/readDir/foo/git-hates-directories +++ /dev/null diff --git a/third_party/nix/src/tests/language-tests.cc b/third_party/nix/src/tests/language-tests.cc deleted file mode 100644 index 46e8c6ea80f7..000000000000 --- a/third_party/nix/src/tests/language-tests.cc +++ /dev/null @@ -1,290 +0,0 @@ -// This file defines the language test suite. Language tests are run -// by evaluating a small snippet of Nix code (against a fake store), -// serialising it to a string and comparing that to a known output. -// -// This test suite is a port of the previous language integration test -// suite, and it's previous structure is retained. -// -// Test cases are written in nix files under lang/, following one of -// four possible filename patterns which trigger different behaviours: -// -// 1. parse-fail-*.nix: These files contain expressions which should -// cause a parser failure. -// -// 2. parse-okay-*.nix: These files contain expressions which should -// parse fine. -// -// 3. eval-fail-*.nix: These files contain expressions which should -// parse, but fail to evaluate. -// -// 4. eval-okay-*.nix: These files contain expressions which should -// parse and evaluate fine. They have accompanying .exp files which -// contain the expected string representation of the evaluation. - -#include <algorithm> -#include <filesystem> -#include <fstream> -#include <iostream> -#include <iterator> -#include <memory> -#include <optional> -#include <sstream> -#include <string> - -#include <absl/strings/ascii.h> -#include <absl/strings/match.h> -#include <absl/strings/str_cat.h> -#include <absl/strings/str_split.h> -#include <absl/strings/string_view.h> -#include <glog/logging.h> -#include <gtest/gtest-param-test.h> -#include <gtest/gtest.h> -#include <gtest/internal/gtest-param-util.h> - -#include "libexpr/eval-inline.hh" -#include "libexpr/eval.hh" -#include "libexpr/nixexpr.hh" -#include "nix_config.h" -#include "tests/dummy-store.hh" -#include "tests/store-util.hh" - -namespace nix::tests { -namespace { - -// List all the language test .nix files matching the given prefix. -std::vector<std::filesystem::path> TestFilesFor(absl::string_view prefix) { - std::vector<std::filesystem::path> matching_files; - - auto dir_iter = - std::filesystem::directory_iterator(NIX_SRC_DIR "/src/tests/lang"); - - for (auto& entry : dir_iter) { - if (!entry.is_regular_file()) { - continue; - } - - auto filename = entry.path().filename().string(); - if (absl::StartsWith(filename, prefix) && - absl::EndsWith(filename, ".nix")) { - matching_files.push_back(entry.path()); - } - } - - std::sort(matching_files.begin(), matching_files.end()); - return matching_files; -} - -// Construct a test name from a path parameter, re-casing its name to -// PascalCase. Googletest only accepts alphanumeric test-names, but -// the file names are in kebab-case. -std::string TestNameFor( - const testing::TestParamInfo<std::filesystem::path>& info) { - std::string name; - - for (auto part : - absl::StrSplit(info.param.stem().string(), '-', absl::SkipEmpty())) { - std::string part_owned(part); - part_owned[0] = absl::ascii_toupper(part_owned[0]); - absl::StrAppend(&name, part_owned); - } - - return name; -} - -// Load the expected output of a given test as a string. -std::string ExpectedOutputFor(absl::string_view stem) { - std::filesystem::path path( - absl::StrCat(NIX_SRC_DIR, "/src/tests/lang/", stem, ".exp")); - - EXPECT_TRUE(std::filesystem::exists(path)) - << stem << ": expected output file should exist"; - - std::ifstream input(path); - std::stringstream buffer; - buffer << input.rdbuf(); - return std::string(absl::StripTrailingAsciiWhitespace(buffer.str())); -} - -} // namespace - -using nix::tests::DummyStore; - -class NixEnvironment : public testing::Environment { - public: - void SetUp() override { - google::InitGoogleLogging("--logtostderr=false"); - nix::expr::InitGC(); - } -}; - -::testing::Environment* const nix_env = - ::testing::AddGlobalTestEnvironment(new NixEnvironment); - -class ParserFailureTest : public testing::TestWithParam<std::filesystem::path> { -}; - -// Test pattern for files that should fail to parse. -TEST_P(ParserFailureTest, Fails) { - std::shared_ptr<Store> store = std::make_shared<DummyStore>(); - EvalState state({}, ref<Store>(store)); - auto path = GetParam(); - - // There are multiple types of exceptions that the parser can throw, - // and the tests don't define which one they expect, so we need to - // allow all of these - but fail on other errors. - try { - state.parseExprFromFile(GetParam().string()); - FAIL() << path.stem().string() << ": parsing should not succeed"; - } catch (ParseError e) { - SUCCEED(); - } catch (UndefinedVarError e) { - SUCCEED(); - } catch (const std::exception& e) { - FAIL() << path.stem().string() - << ": unexpected parser exception: " << e.what(); - } -} - -INSTANTIATE_TEST_SUITE_P(Parser, ParserFailureTest, - testing::ValuesIn(TestFilesFor("parse-fail-")), - TestNameFor); - -class ParserSuccessTest : public testing::TestWithParam<std::filesystem::path> { -}; - -// Test pattern for files that should parse successfully. -TEST_P(ParserSuccessTest, Parses) { - std::shared_ptr<Store> store = std::make_shared<DummyStore>(); - EvalState state({}, ref<Store>(store)); - auto path = GetParam(); - - EXPECT_NO_THROW(state.parseExprFromFile(GetParam().string())) - << path.stem().string() << ": parsing should succeed"; - - SUCCEED(); -} - -INSTANTIATE_TEST_SUITE_P(Parser, ParserSuccessTest, - testing::ValuesIn(TestFilesFor("parse-okay-")), - TestNameFor); - -class EvalFailureTest : public testing::TestWithParam<std::filesystem::path> {}; - -// Test pattern for files that should fail to evaluate. -TEST_P(EvalFailureTest, Fails) { - std::shared_ptr<Store> store = std::make_shared<DummyStore>(); - EvalState state({}, ref<Store>(store)); - auto path = GetParam(); - - Expr* expr = nullptr; - EXPECT_NO_THROW(expr = state.parseExprFromFile(GetParam().string())) - << path.stem().string() << ": should parse successfully"; - - // Again, there are multiple expected exception types and the tests - // don't specify which ones they are looking for. - try { - Value result; - state.eval(expr, result); - state.forceValue(result); - std::cout << result; - FAIL() << path.stem().string() << ": evaluating should not succeed"; - } catch (AssertionError e) { - SUCCEED(); - } catch (EvalError e) { - SUCCEED(); - } catch (SysError e) { - SUCCEED(); - } catch (ParseError /* sic! */ e) { - SUCCEED(); - } catch (const std::exception& e) { - FAIL() << path.stem().string() - << ": unexpected evaluator exception: " << e.what(); - } -} - -INSTANTIATE_TEST_SUITE_P(Eval, EvalFailureTest, - testing::ValuesIn(TestFilesFor("eval-fail-")), - TestNameFor); - -class EvalSuccessTest : public testing::TestWithParam<std::filesystem::path> {}; - -// Test pattern for files that should evaluate successfully. -TEST_P(EvalSuccessTest, Succeeds) { - std::shared_ptr<Store> store = std::make_shared<DummyStore>(); - EvalState state({}, ref<Store>(store)); - auto path = GetParam(); - - Expr* expr = nullptr; - ASSERT_NO_THROW(expr = state.parseExprFromFile(GetParam().string())) - << path.stem().string() << ": should parse successfully"; - - Value result; - - ASSERT_NO_THROW({ - state.eval(expr, result); - state.forceValueDeep(result); - }) << path.stem().string() - << ": should evaluate successfully"; - - auto expected = ExpectedOutputFor(path.stem().string()); - std::ostringstream value_str; - value_str << result; - - EXPECT_EQ(expected, value_str.str()) << "evaluator output should match"; -} - -INSTANTIATE_TEST_SUITE_P(Eval, EvalSuccessTest, - testing::ValuesIn(TestFilesFor("eval-okay-")), - TestNameFor); - -class BlankStoreTest : public nix::StoreTest { - virtual void TestBody() override{}; -}; - -class EvalStoreSuccessTest - : public testing::TestWithParam<std::filesystem::path> { - public: - virtual void TearDown() { store_test_.TearDown(); } - - absl::StatusOr<std::unique_ptr<nix::LocalStore>> OpenTemporaryStore() { - return store_test_.OpenTemporaryStore(); - } - - private: - BlankStoreTest store_test_; -}; - -// Test pattern for files that should evaluate successfully but require a real -// store. -TEST_P(EvalStoreSuccessTest, Succeeds) { - absl::StatusOr<std::unique_ptr<nix::LocalStore>> store_ = - OpenTemporaryStore(); - CHECK(store_.ok()) << "failed to open temporary store"; - ref<Store> store = ref<Store>(store_->release()); - EvalState state({}, store); - auto path = GetParam(); - - Expr* expr = nullptr; - ASSERT_NO_THROW(expr = state.parseExprFromFile(GetParam().string())) - << path.stem().string() << ": should parse successfully"; - - Value result; - - ASSERT_NO_THROW({ - state.eval(expr, result); - state.forceValueDeep(result); - }) << path.stem().string() - << ": should evaluate successfully"; - - auto expected = ExpectedOutputFor(path.stem().string()); - std::ostringstream value_str; - value_str << result; - - EXPECT_EQ(expected, value_str.str()) << "evaluator output should match"; -} - -INSTANTIATE_TEST_SUITE_P(Eval, EvalStoreSuccessTest, - testing::ValuesIn(TestFilesFor("evalstore-okay-")), - TestNameFor); - -} // namespace nix::tests diff --git a/third_party/nix/src/tests/references_test.cc b/third_party/nix/src/tests/references_test.cc deleted file mode 100644 index 8dcb3ed37a8b..000000000000 --- a/third_party/nix/src/tests/references_test.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "libstore/references.hh" - -#include <cstdio> -#include <fstream> -#include <ostream> -#include <unordered_set> - -#include <absl/strings/str_format.h> -#include <gtest/gtest.h> -#include <rapidcheck.h> -#include <rapidcheck/gtest.h> - -#include "libutil/hash.hh" - -class ReferencesTest : public ::testing::Test {}; - -namespace nix { - -TEST(ReferencesTest, ScanForOneReferenceNotFound) { - char path[] = "store_XXXXXXX"; - auto f = mkstemp(path); - - auto hash = hashString(htSHA256, "foo"); - auto ref = absl::StrFormat("/nix/store/%s-foo", hash.ToStorePathHash()); - - HashResult hr; - auto result = scanForReferences(path, {ref}, hr); - - ASSERT_EQ(result.find(ref), result.end()); - - EXPECT_EQ(close(f), 0); -} - -TEST(ReferencesTest, ScanForOneReferenceFound) { - char path[] = "store_XXXXXXX"; - auto f = mkstemp(path); - - auto hash = hashString(htSHA256, "foo"); - auto ref = absl::StrFormat("/nix/store/%s-foo", hash.ToStorePathHash()); - - EXPECT_GT(write(f, ref.c_str(), sizeof(char) * ref.size()), 0); - - HashResult hr; - auto result = scanForReferences(path, {ref}, hr); - - ASSERT_NE(result.find(ref), result.end()); - - ASSERT_EQ(close(f), 0); -} - -RC_GTEST_PROP(ReferencesTest, ScanForReferences, - (std::unordered_set<std::string> strs)) { - char path[] = "store_XXXXXXX"; - auto f = mkstemp(path); - - PathSet refs; - for (const auto& s : strs) { - auto hash = hashString(htSHA256, s); - auto ref = absl::StrFormat("/nix/store/%s-foo", hash.ToStorePathHash()); - refs.insert(ref); - RC_ASSERT(write(f, ref.c_str(), sizeof(char) * ref.size()) > 0); - } - - HashResult hr; - auto result = scanForReferences(path, refs, hr); - - for (const auto& ref : refs) { - RC_ASSERT(result.find(ref) != result.end()); - } - - RC_ASSERT(close(f) == 0); -} - -} // namespace nix diff --git a/third_party/nix/src/tests/status_helpers.h b/third_party/nix/src/tests/status_helpers.h deleted file mode 100644 index ca596dbb5254..000000000000 --- a/third_party/nix/src/tests/status_helpers.h +++ /dev/null @@ -1,83 +0,0 @@ -#pragma once - -#include <absl/status/status.h> -#include <absl/status/statusor.h> -#include <absl/strings/str_cat.h> -#include <gmock/gmock.h> -#include <gtest/gtest.h> - -namespace testing { - -/* - * This file contains gtest matchers for absl::Status. - * - * Example usage: - * - * EXPECT_OK(status); -- fails the test if 'status' is an error - * ASSERT_OK(status); -- instantly fails the test if error - * - * using ::testing::IsStatusCode; - * EXPECT_THAT(status, IsStatusCode(absl::StatusCode::kInternal)); - */ - -namespace nix_internal { - -using ::testing::MakeMatcher; -using ::testing::Matcher; -using ::testing::MatcherInterface; -using ::testing::MatchResultListener; - -MATCHER_P(IsStatusCode, code, "") { return arg.code() == code; } - -class StatusCodeMatcher { - public: - StatusCodeMatcher(absl::StatusCode code) : code_(code) {} - - // Match on absl::Status. - template <class T, - typename std::enable_if<std::is_same<T, absl::Status>::value, - int>::type int_ = 0> - bool MatchAndExplain(const T& status, - MatchResultListener* /* listener */) const { - return status.code() == code_; - } - - // Match on absl::StatusOr. - // - // note: I check for the return value of ConsumeValueOrDie because it's the - // only non-overloaded member I could figure out how to select. Checking for - // the presence of .status() didn't work because it's overloaded, so - // std::invoke_result can't pick which overload to use. - template <class T, - typename std::enable_if< - std::is_same<typename std::invoke_result< - decltype(&T::ConsumeValueOrDie), T>::type, - typename T::value_type>::value, - int>::type int_ = 0> - bool MatchAndExplain(const T& statusor, - MatchResultListener* /* listener */) const { - return statusor.status().code() == code_; - } - - void DescribeTo(std::ostream* os) const { *os << "is " << code_; } - - void DescribeNegationTo(std::ostream* os) const { *os << "isn't " << code_; } - - private: - absl::StatusCode code_; -}; - -} // namespace nix_internal - -PolymorphicMatcher<nix_internal::StatusCodeMatcher> IsStatusCode( - absl::StatusCode code) { - return MakePolymorphicMatcher(nix_internal::StatusCodeMatcher(code)); -} - -#define EXPECT_OK(status) \ - EXPECT_THAT((status), testing::IsStatusCode(absl::StatusCode::kOk)) - -#define ASSERT_OK(status) \ - ASSERT_THAT((status), testing::IsStatusCode(absl::StatusCode::kOk)) - -} // namespace testing diff --git a/third_party/nix/src/tests/store-api-test.cc b/third_party/nix/src/tests/store-api-test.cc deleted file mode 100644 index 259e4b991b57..000000000000 --- a/third_party/nix/src/tests/store-api-test.cc +++ /dev/null @@ -1,28 +0,0 @@ -#include "libstore/store-api.hh" - -#include <gtest/gtest.h> -#include <rapidcheck/Assertions.h> -#include <rapidcheck/gtest.h> - -#include "libproto/worker.pb.h" -#include "tests/arbitrary.hh" - -namespace nix { - -class BuildResultTest : public ::testing::Test {}; - -RC_GTEST_PROP(BuildResultTest, StatusToFromProtoRoundTrip, - (BuildResult::Status && status)) { - BuildResult br; - br.status = status; - - auto proto_status = br.status_to_proto(); - nix::proto::BuildResult br_proto; - br_proto.set_status(proto_status); - - auto result = BuildResult::FromProto(br_proto); - - RC_ASSERT(result.value().status == status); -} - -} // namespace nix diff --git a/third_party/nix/src/tests/store-util.hh b/third_party/nix/src/tests/store-util.hh deleted file mode 100644 index b31bb0edcb8f..000000000000 --- a/third_party/nix/src/tests/store-util.hh +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include <filesystem> - -#include <absl/status/statusor.h> -#include <absl/strings/escaping.h> -#include <glog/logging.h> -#include <sys/random.h> - -#include "libstore/local-store.hh" - -namespace nix { - -class StoreTest : public ::testing::Test { - public: - virtual void TearDown() { - for (auto fn : cleanup_funcs_) { - try { - fn(); - } catch (std::exception e) { - LOG(ERROR) << e.what(); - } - } - } - - absl::StatusOr<std::filesystem::path> OpenTempDir( - std::filesystem::path parent = std::filesystem::temp_directory_path()) { - for (;;) { - constexpr int kByteCnt = 9; - std::array<char, kByteCnt> randBytes; - if (getrandom(randBytes.data(), kByteCnt, 0) < 0) { - return absl::InternalError("getrandom() failed"); - } - std::string suffix = absl::WebSafeBase64Escape( - absl::string_view(randBytes.data(), kByteCnt)); - CHECK(suffix != ""); - - // Workaround for stdlib bug: use .assign() and ::errc - // https://stackoverflow.com/a/52401295/1210278 - std::error_code ec_exists; - ec_exists.assign(EEXIST, std::system_category()); - - std::error_code ec; - std::filesystem::path candidate = - parent / absl::StrCat("nixtest-", suffix); - if (std::filesystem::create_directory(candidate, ec)) { - cleanup_funcs_.push_back( - [candidate]() { std::filesystem::remove_all(candidate); }); - return candidate; - } else if (ec == ec_exists || ec == std::errc::file_exists) { - // Directory existed, retry - continue; - } else { - return absl::InternalError(absl::StrCat( - "could not create dir ", candidate.c_str(), ": ", ec.message())); - } - } - } - - absl::StatusOr<std::unique_ptr<nix::LocalStore>> OpenTemporaryStore() { - absl::StatusOr<std::filesystem::path> storePath = OpenTempDir(); - if (!storePath.ok()) { - return storePath.status(); - } - - nix::Store::Params params; - params["root"] = *storePath; - - return std::make_unique<nix::LocalStore>(params); - } - - private: - std::vector<std::function<void(void)>> cleanup_funcs_; -}; - -} // namespace nix diff --git a/third_party/nix/src/tests/store_tests.cc b/third_party/nix/src/tests/store_tests.cc deleted file mode 100644 index a6ffb715a90f..000000000000 --- a/third_party/nix/src/tests/store_tests.cc +++ /dev/null @@ -1,122 +0,0 @@ -#include <filesystem> - -#include <absl/container/btree_map.h> -#include <absl/container/flat_hash_map.h> -#include <absl/strings/escaping.h> -#include <glog/logging.h> -#include <gmock/gmock.h> -#include <gtest/gtest.h> -#include <sys/random.h> - -#include "libstore/binary-cache-store.hh" -#include "libstore/mock-binary-cache-store.hh" -#include "tests/store-util.hh" - -using ::testing::HasSubstr; - -namespace nix { - -MakeError(InjectedError, Error); - -class BinaryCacheStoreTest : public StoreTest {}; - -constexpr absl::string_view kXZHeader = "7zXZ"; - -constexpr absl::string_view kRootFileName = "myRootFile"; -constexpr absl::string_view kDep1FileName = "dep1"; -constexpr absl::string_view kDep1FileContents = "==dep1 contents=="; -constexpr absl::string_view kDep1NarCache = - "nar/0hfdc95cy6mxi4c15pp0frdf97r7yvd8c141qzvpms2f8x17p2ig.nar.xz"; -constexpr absl::string_view kBogusPath = - "/nix/store/g1ghizdg18k0d00000000000000z3v32-doesNotExist"; - -struct TestTree { - Path rootPath; - Path dep1Path; -}; - -TestTree AddTestTreeToStore(Store& store) { - TestTree results; - results.rootPath = - store.addTextToStore(std::string(kRootFileName), "1", PathSet()); - - PathSet onlyRoot; - onlyRoot.insert(results.rootPath); - results.dep1Path = store.addTextToStore( - std::string(kDep1FileName), std::string(kDep1FileContents), onlyRoot); - - return results; -} - -TEST_F(BinaryCacheStoreTest, BasicStorage) { - MockBinaryCacheStore::Params params; - MockBinaryCacheStore store(params); - - store.init(); - - auto tree = AddTestTreeToStore(store); - - EXPECT_TRUE(store.isValidPath(tree.rootPath)); - EXPECT_TRUE(store.isValidPath(tree.dep1Path)); - - StringSink sink; - store.narFromPath(tree.dep1Path, sink); - EXPECT_THAT(*sink.s, HasSubstr(kDep1FileContents)); - - EXPECT_THAT(*store.BinaryCacheStore::getFile(Path(kDep1NarCache)), - HasSubstr(kXZHeader)); -} - -TEST_F(BinaryCacheStoreTest, BasicErrors) { - MockBinaryCacheStore::Params params; - MockBinaryCacheStore store(params); - - store.init(); - - auto tree = AddTestTreeToStore(store); - store.PrepareErrorInjection(std::string(kDep1NarCache), - []() { throw InjectedError("injected"); }); - - { - StringSink sink; - EXPECT_THROW(store.narFromPath(tree.dep1Path, sink), InjectedError); - } - { - StringSink sink; - EXPECT_THROW(store.narFromPath(std::string(kBogusPath), sink), - NoSuchBinaryCacheFile); - } -} - -// ./tests/add.sh -TEST_F(StoreTest, AddFileHashes) { - auto store_ = OpenTemporaryStore(); - CHECK(store_.ok()) << "failed to open temporary store"; - nix::Store* store = store_->release(); - nix::Path dataPath = NIX_SRC_DIR "/src/tests/lang/data"; - std::string dataName = "data"; - - nix::Path path1 = store->addToStore(dataName, dataPath); - - nix::Path path2 = store->addToStore(dataName, dataPath, /*recursive=*/true, - HashType::htSHA256); - - EXPECT_EQ(path1, path2) << "nix-store --add and --add-fixed mismatch"; - - nix::Path path3 = store->addToStore(dataName, dataPath, /*recursive=*/false, - HashType::htSHA256); - EXPECT_NE(path1, path3); - - nix::Path path4 = - store->addToStore(dataName, dataPath, false, HashType::htSHA1); - EXPECT_NE(path1, path4); - - auto info1 = store->queryPathInfo(store->followLinksToStorePath(path1)); - ASSERT_EQ(info1->narHash.type, HashType::htSHA256); - - Hash h = nix::hashPath(HashType::htSHA256, dataPath).first; - - EXPECT_EQ(info1->narHash.to_string(), h.to_string()); -} - -} // namespace nix diff --git a/third_party/nix/src/tests/value-to-json.cc b/third_party/nix/src/tests/value-to-json.cc deleted file mode 100644 index 45427425306f..000000000000 --- a/third_party/nix/src/tests/value-to-json.cc +++ /dev/null @@ -1,257 +0,0 @@ -#include "libexpr/value-to-json.hh" - -#include <set> -#include <sstream> - -#include <gtest/gtest.h> - -#include "libexpr/value-to-xml.hh" -#include "libexpr/value.hh" -#include "libstore/store-api.hh" -#include "tests/dummy-store.hh" - -class ValueTest : public ::testing::Test { - protected: - static void SetUpTestCase() { nix::expr::InitGC(); } - - static void TearDownTestCase() {} -}; - -class JSONValueTest : public ValueTest {}; -class XMLValueTest : public ValueTest {}; - -namespace nix { - -using nix::tests::DummyStore; - -TEST_F(JSONValueTest, null) { - std::stringstream ss; - Value v; - PathSet ps; - std::shared_ptr<Store> store = std::make_shared<DummyStore>(); - EvalState s({}, ref<Store>(store)); - - mkNull(v); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "null"); -} - -TEST_F(JSONValueTest, BoolFalse) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkBool(v, false); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "false"); -} - -TEST_F(JSONValueTest, BoolTrue) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkBool(v, true); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "true"); -} - -TEST_F(JSONValueTest, IntPositive) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkInt(v, 100); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "100"); -} - -TEST_F(JSONValueTest, IntNegative) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkInt(v, -100); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "-100"); -} - -TEST_F(JSONValueTest, String) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkString(v, "test"); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "\"test\""); -} - -TEST_F(JSONValueTest, StringQuotes) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkString(v, "test\""); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "\"test\\\"\""); -} - -TEST_F(JSONValueTest, Path) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkPathNoCopy(v, "/exists-for-tests"); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "\"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x\""); -} - -TEST_F(JSONValueTest, PathNoCopy) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkPathNoCopy(v, "/exists-for-tests"); - printValueAsJSON(s, true, v, ss, ps); - ASSERT_EQ(ss.str(), "\"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x\""); -} - -/* - * Value to XMl tests - */ - -#define XML(v) \ - ("<?xml version='1.0' encoding='utf-8'?>\n<expr>\n" v "\n</expr>\n") - -TEST_F(XMLValueTest, null) { - std::stringstream ss; - Value v; - PathSet ps; - auto store = std::make_shared<DummyStore>(); - EvalState s({}, ref<Store>(store)); - - mkNull(v); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <null />")); -} - -TEST_F(XMLValueTest, BoolFalse) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkBool(v, false); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <bool value=\"false\" />")); -} - -TEST_F(XMLValueTest, BoolTrue) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkBool(v, true); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <bool value=\"true\" />")); -} - -TEST_F(XMLValueTest, IntPositive) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkInt(v, 100); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <int value=\"100\" />")); -} - -TEST_F(XMLValueTest, IntNegative) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkInt(v, -100); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <int value=\"-100\" />")); -} - -TEST_F(XMLValueTest, String) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkString(v, "test-value"); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <string value=\"test-value\" />")); -} - -TEST_F(XMLValueTest, StringQuotes) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkString(v, "test-value\""); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <string value=\"test-value"\" />")); -} - -/* - * FIXME: This function returns the original input path while the JSON version - * of the same actually touches the store to create a /nix/store path. - */ -TEST_F(XMLValueTest, Path) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkPath(v, "some-path"); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <path value=\"some-path\" />")); -} - -/* - * FIXME: This function returns the original input path while the JSON version - * of the same actually touches the store to create a /nix/store path. - */ -TEST_F(XMLValueTest, PathNoCopy) { - std::stringstream ss; - auto store = std::make_shared<DummyStore>(); - EvalState s({"."}, ref<Store>(store)); - Value v; - PathSet ps; - - mkPathNoCopy(v, "some-other-path"); - printValueAsXML(s, true, true, v, ss, ps); - ASSERT_EQ(ss.str(), XML(" <path value=\"some-other-path\" />")); -} -} // namespace nix |