#include "outputs-spec.hh" #include namespace nix { TEST(parseOutputsSpec, basic) { { auto [prefix, outputsSpec] = parseOutputsSpec("foo"); ASSERT_EQ(prefix, "foo"); ASSERT_TRUE(std::get_if(&outputsSpec)); } { auto [prefix, outputsSpec] = parseOutputsSpec("foo^*"); ASSERT_EQ(prefix, "foo"); ASSERT_TRUE(std::get_if(&outputsSpec)); } { auto [prefix, outputsSpec] = parseOutputsSpec("foo^out"); ASSERT_EQ(prefix, "foo"); ASSERT_TRUE(std::get(outputsSpec) == OutputNames({"out"})); } { auto [prefix, outputsSpec] = parseOutputsSpec("foo^out,bin"); ASSERT_EQ(prefix, "foo"); ASSERT_TRUE(std::get(outputsSpec) == OutputNames({"out", "bin"})); } { auto [prefix, outputsSpec] = parseOutputsSpec("foo^bar^out,bin"); ASSERT_EQ(prefix, "foo^bar"); ASSERT_TRUE(std::get(outputsSpec) == OutputNames({"out", "bin"})); } { auto [prefix, outputsSpec] = parseOutputsSpec("foo^&*()"); ASSERT_EQ(prefix, "foo^&*()"); ASSERT_TRUE(std::get_if(&outputsSpec)); } } }