summaryrefslogtreecommitdiffstats
path: root/node_modules/node-sass/src/libsass/test
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
commite06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch)
tree55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/node-sass/src/libsass/test
downloadwebsite_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip
api, login, auth
Diffstat (limited to 'node_modules/node-sass/src/libsass/test')
-rw-r--r--node_modules/node-sass/src/libsass/test/test_node.cpp94
-rw-r--r--node_modules/node-sass/src/libsass/test/test_paths.cpp28
-rw-r--r--node_modules/node-sass/src/libsass/test/test_selector_difference.cpp25
-rw-r--r--node_modules/node-sass/src/libsass/test/test_specificity.cpp25
-rw-r--r--node_modules/node-sass/src/libsass/test/test_subset_map.cpp472
-rw-r--r--node_modules/node-sass/src/libsass/test/test_superselector.cpp69
-rw-r--r--node_modules/node-sass/src/libsass/test/test_unification.cpp31
7 files changed, 744 insertions, 0 deletions
diff --git a/node_modules/node-sass/src/libsass/test/test_node.cpp b/node_modules/node-sass/src/libsass/test/test_node.cpp
new file mode 100644
index 0000000..905dc18
--- /dev/null
+++ b/node_modules/node-sass/src/libsass/test/test_node.cpp
@@ -0,0 +1,94 @@
+#include <assert.h>
+#include <sstream>
+
+#include "node.hpp"
+#include "parser.hpp"
+
+
+#define STATIC_ARRAY_SIZE(array) (sizeof((array))/sizeof((array[0])))
+
+
+namespace Sass {
+
+ Context ctx = Context::Data();
+
+ const char* const ROUNDTRIP_TESTS[] = {
+ NULL,
+ "~",
+ "CMPD",
+ "~ CMPD",
+ "CMPD >",
+ "> > CMPD",
+ "CMPD ~ ~",
+ "> + CMPD1.CMPD2 > ~",
+ "> + CMPD1.CMPD2 CMPD3.CMPD4 > ~",
+ "+ CMPD1 CMPD2 ~ CMPD3 + CMPD4 > CMPD5 > ~"
+ };
+
+
+
+ static Complex_Selector* createComplexSelector(std::string src) {
+ std::string temp(src);
+ temp += ";";
+ return (*Parser::from_c_str(temp.c_str(), ctx, "", Position()).parse_selector_list())[0];
+ }
+
+
+ void roundtripTest(const char* toTest) {
+
+ // Create the initial selector
+
+ Complex_Selector* pOrigSelector = NULL;
+ if (toTest) {
+ pOrigSelector = createComplexSelector(toTest);
+ }
+
+ std::string expected(pOrigSelector ? pOrigSelector->to_string() : "NULL");
+
+
+ // Roundtrip the selector into a node and back
+
+ Node node = complexSelectorToNode(pOrigSelector, ctx);
+
+ std::stringstream nodeStringStream;
+ nodeStringStream << node;
+ std::string nodeString = nodeStringStream.str();
+ cout << "ASNODE: " << node << endl;
+
+ Complex_Selector* pNewSelector = nodeToComplexSelector(node, ctx);
+
+ // Show the result
+
+ std::string result(pNewSelector ? pNewSelector->to_string() : "NULL");
+
+ cout << "SELECTOR: " << expected << endl;
+ cout << "NEW SELECTOR: " << result << endl;
+
+
+ // Test that they are equal using the equality operator
+
+ assert( (!pOrigSelector && !pNewSelector ) || (pOrigSelector && pNewSelector) );
+ if (pOrigSelector) {
+ assert( *pOrigSelector == *pNewSelector );
+ }
+
+
+ // Test that they are equal by comparing the string versions of the selectors
+
+ assert(expected == result);
+
+ }
+
+
+ int main() {
+ for (int index = 0; index < STATIC_ARRAY_SIZE(ROUNDTRIP_TESTS); index++) {
+ const char* const toTest = ROUNDTRIP_TESTS[index];
+ cout << "\nINPUT STRING: " << (toTest ? toTest : "NULL") << endl;
+ roundtripTest(toTest);
+ }
+
+ cout << "\nTesting Done.\n";
+ }
+
+
+}
diff --git a/node_modules/node-sass/src/libsass/test/test_paths.cpp b/node_modules/node-sass/src/libsass/test/test_paths.cpp
new file mode 100644
index 0000000..bfcf8ec
--- /dev/null
+++ b/node_modules/node-sass/src/libsass/test/test_paths.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+#include "../paths.hpp"
+
+using namespace Sass;
+
+template<typename T>
+std::vector<T>& operator<<(std::vector<T>& v, const T& e)
+{
+ v.push_back(e);
+ return v;
+}
+
+int main()
+{
+ std::vector<int> v1, v2, v3;
+ v1 << 1 << 2;
+ v2 << 3;
+ v3 << 4 << 5 << 6;
+
+ std::vector<std::vector<int> > ss;
+ ss << v1 << v2 << v3;
+
+ std::vector<std::vector<int> > ps = paths(ss);
+ for (size_t i = 0, S = ps.size(); i < S; ++i) {
+ std::cout << vector_to_string(ps[i]) << std::endl;
+ }
+ return 0;
+}
diff --git a/node_modules/node-sass/src/libsass/test/test_selector_difference.cpp b/node_modules/node-sass/src/libsass/test/test_selector_difference.cpp
new file mode 100644
index 0000000..e2880c0
--- /dev/null
+++ b/node_modules/node-sass/src/libsass/test/test_selector_difference.cpp
@@ -0,0 +1,25 @@
+#include "../ast.hpp"
+#include "../context.hpp"
+#include "../parser.hpp"
+#include <string>
+#include <iostream>
+
+using namespace Sass;
+
+Context ctx = Context::Data();
+
+Compound_Selector* selector(std::string src)
+{ return Parser::from_c_str(src.c_str(), ctx, "", Position()).parse_compound_selector(); }
+
+void diff(std::string s, std::string t)
+{
+ std::cout << s << " - " << t << " = " << selector(s + ";")->minus(selector(t + ";"), ctx)->to_string() << std::endl;
+}
+
+int main()
+{
+ diff(".a.b.c", ".c.b");
+ diff(".a.b.c", ".fludge.b");
+
+ return 0;
+}
diff --git a/node_modules/node-sass/src/libsass/test/test_specificity.cpp b/node_modules/node-sass/src/libsass/test/test_specificity.cpp
new file mode 100644
index 0000000..ba9bbfc
--- /dev/null
+++ b/node_modules/node-sass/src/libsass/test/test_specificity.cpp
@@ -0,0 +1,25 @@
+#include "../ast.hpp"
+#include "../context.hpp"
+#include "../parser.hpp"
+#include <string>
+#include <iostream>
+
+using namespace Sass;
+
+Context ctx = Context::Data();
+
+Selector* selector(std::string src)
+{ return Parser::from_c_str(src.c_str(), ctx, "", Position()).parse_selector_list(); }
+
+void spec(std::string sel)
+{ std::cout << sel << "\t::\t" << selector(sel + ";")->specificity() << std::endl; }
+
+int main()
+{
+ spec("foo bar hux");
+ spec(".foo .bar hux");
+ spec("#foo .bar[hux='mux']");
+ spec("a b c d e f");
+
+ return 0;
+}
diff --git a/node_modules/node-sass/src/libsass/test/test_subset_map.cpp b/node_modules/node-sass/src/libsass/test/test_subset_map.cpp
new file mode 100644
index 0000000..3794514
--- /dev/null
+++ b/node_modules/node-sass/src/libsass/test/test_subset_map.cpp
@@ -0,0 +1,472 @@
+#include <string>
+#include <iostream>
+#include <assert.h>
+#include "../subset_map.hpp"
+
+Subset_Map<std::string, std::string> ssm;
+
+string toString(std::vector<std::string> v);
+string toString(std::vector<std::pair<std::string, std::vector<std::string>>> v);
+void assertEqual(string std::sExpected, std::string sResult);
+
+void setup() {
+ ssm.clear();
+
+ //@ssm[Set[1, 2]] = "Foo"
+ std::vector<std::string> s1;
+ s1.push_back("1");
+ s1.push_back("2");
+ ssm.put(s1, "Foo");
+
+ //@ssm[Set["fizz", "fazz"]] = "Bar"
+ std::vector<std::string> s2;
+ s2.push_back("fizz");
+ s2.push_back("fazz");
+ ssm.put(s2, "Bar");
+
+ //@ssm[Set[:foo, :bar]] = "Baz"
+ std::vector<std::string> s3;
+ s3.push_back(":foo");
+ s3.push_back(":bar");
+ ssm.put(s3, "Baz");
+
+ //@ssm[Set[:foo, :bar, :baz]] = "Bang"
+ std::vector<std::string> s4;
+ s4.push_back(":foo");
+ s4.push_back(":bar");
+ s4.push_back(":baz");
+ ssm.put(s4, "Bang");
+
+ //@ssm[Set[:bip, :bop, :blip]] = "Qux"
+ std::vector<std::string> s5;
+ s5.push_back(":bip");
+ s5.push_back(":bop");
+ s5.push_back(":blip");
+ ssm.put(s5, "Qux");
+
+ //@ssm[Set[:bip, :bop]] = "Thram"
+ std::vector<std::string> s6;
+ s6.push_back(":bip");
+ s6.push_back(":bop");
+ ssm.put(s6, "Thram");
+}
+
+void testEqualKeys() {
+ std::cout << "testEqualKeys" << std::endl;
+
+ //assert_equal [["Foo", Set[1, 2]]], @ssm.get(Set[1, 2])
+ std::vector<std::string> k1;
+ k1.push_back("1");
+ k1.push_back("2");
+ assertEqual("[[Foo, Set[1, 2]]]", toString(ssm.get_kv(k1)));
+
+ //assert_equal [["Bar", Set["fizz", "fazz"]]], @ssm.get(Set["fizz", "fazz"])
+ std::vector<std::string> k2;
+ k2.push_back("fizz");
+ k2.push_back("fazz");
+ assertEqual("[[Bar, Set[fizz, fazz]]]", toString(ssm.get_kv(k2)));
+
+ std::cout << std::endl;
+}
+
+void testSubsetKeys() {
+ std::cout << "testSubsetKeys" << std::endl;
+
+ //assert_equal [["Foo", Set[1, 2]]], @ssm.get(Set[1, 2, "fuzz"])
+ std::vector<std::string> k1;
+ k1.push_back("1");
+ k1.push_back("2");
+ k1.push_back("fuzz");
+ assertEqual("[[Foo, Set[1, 2]]]", toString(ssm.get_kv(k1)));
+
+ //assert_equal [["Bar", Set["fizz", "fazz"]]], @ssm.get(Set["fizz", "fazz", 3])
+ std::vector<std::string> k2;
+ k2.push_back("fizz");
+ k2.push_back("fazz");
+ k2.push_back("3");
+ assertEqual("[[Bar, Set[fizz, fazz]]]", toString(ssm.get_kv(k2)));
+
+ std::cout << std::endl;
+}
+
+void testSupersetKeys() {
+ std::cout << "testSupersetKeys" << std::endl;
+
+ //assert_equal [], @ssm.get(Set[1])
+ std::vector<std::string> k1;
+ k1.push_back("1");
+ assertEqual("[]", toString(ssm.get_kv(k1)));
+
+ //assert_equal [], @ssm.get(Set[2])
+ std::vector<std::string> k2;
+ k2.push_back("2");
+ assertEqual("[]", toString(ssm.get_kv(k2)));
+
+ //assert_equal [], @ssm.get(Set["fizz"])
+ std::vector<std::string> k3;
+ k3.push_back("fizz");
+ assertEqual("[]", toString(ssm.get_kv(k3)));
+
+ //assert_equal [], @ssm.get(Set["fazz"])
+ std::vector<std::string> k4;
+ k4.push_back("fazz");
+ assertEqual("[]", toString(ssm.get_kv(k4)));
+
+ std::cout << std::endl;
+}
+
+void testDisjointKeys() {
+ std::cout << "testDisjointKeys" << std::endl;
+
+ //assert_equal [], @ssm.get(Set[3, 4])
+ std::vector<std::string> k1;
+ k1.push_back("3");
+ k1.push_back("4");
+ assertEqual("[]", toString(ssm.get_kv(k1)));
+
+ //assert_equal [], @ssm.get(Set["fuzz", "frizz"])
+ std::vector<std::string> k2;
+ k2.push_back("fuzz");
+ k2.push_back("frizz");
+ assertEqual("[]", toString(ssm.get_kv(k2)));
+
+ //assert_equal [], @ssm.get(Set["gran", 15])
+ std::vector<std::string> k3;
+ k3.push_back("gran");
+ k3.push_back("15");
+ assertEqual("[]", toString(ssm.get_kv(k3)));
+
+ std::cout << std::endl;
+}
+
+void testSemiDisjointKeys() {
+ std::cout << "testSemiDisjointKeys" << std::endl;
+
+ //assert_equal [], @ssm.get(Set[2, 3])
+ std::vector<std::string> k1;
+ k1.push_back("2");
+ k1.push_back("3");
+ assertEqual("[]", toString(ssm.get_kv(k1)));
+
+ //assert_equal [], @ssm.get(Set["fizz", "fuzz"])
+ std::vector<std::string> k2;
+ k2.push_back("fizz");
+ k2.push_back("fuzz");
+ assertEqual("[]", toString(ssm.get_kv(k2)));
+
+ //assert_equal [], @ssm.get(Set[1, "fazz"])
+ std::vector<std::string> k3;
+ k3.push_back("1");
+ k3.push_back("fazz");
+ assertEqual("[]", toString(ssm.get_kv(k3)));
+
+ std::cout << std::endl;
+}
+
+void testEmptyKeySet() {
+ std::cout << "testEmptyKeySet" << std::endl;
+
+ //assert_raises(ArgumentError) {@ssm[Set[]] = "Fail"}
+ std::vector<std::string> s1;
+ try {
+ ssm.put(s1, "Fail");
+ }
+ catch (const char* &e) {
+ assertEqual("internal error: subset map keys may not be empty", e);
+ }
+}
+
+void testEmptyKeyGet() {
+ std::cout << "testEmptyKeyGet" << std::endl;
+
+ //assert_equal [], @ssm.get(Set[])
+ std::vector<std::string> k1;
+ assertEqual("[]", toString(ssm.get_kv(k1)));
+
+ std::cout << std::endl;
+}
+void testMultipleSubsets() {
+ std::cout << "testMultipleSubsets" << std::endl;
+
+ //assert_equal [["Foo", Set[1, 2]], ["Bar", Set["fizz", "fazz"]]], @ssm.get(Set[1, 2, "fizz", "fazz"])
+ std::vector<std::string> k1;
+ k1.push_back("1");
+ k1.push_back("2");
+ k1.push_back("fizz");
+ k1.push_back("fazz");
+ assertEqual("[[Foo, Set[1, 2]], [Bar, Set[fizz, fazz]]]", toString(ssm.get_kv(k1)));
+
+ //assert_equal [["Foo", Set[1, 2]], ["Bar", Set["fizz", "fazz"]]], @ssm.get(Set[1, 2, 3, "fizz", "fazz", "fuzz"])
+ std::vector<std::string> k2;
+ k2.push_back("1");
+ k2.push_back("2");
+ k2.push_back("3");
+ k2.push_back("fizz");
+ k2.push_back("fazz");
+ k2.push_back("fuzz");
+ assertEqual("[[Foo, Set[1, 2]], [Bar, Set[fizz, fazz]]]", toString(ssm.get_kv(k2)));
+
+ //assert_equal [["Baz", Set[:foo, :bar]]], @ssm.get(Set[:foo, :bar])
+ std::vector<std::string> k3;
+ k3.push_back(":foo");
+ k3.push_back(":bar");
+ assertEqual("[[Baz, Set[:foo, :bar]]]", toString(ssm.get_kv(k3)));
+
+ //assert_equal [["Baz", Set[:foo, :bar]], ["Bang", Set[:foo, :bar, :baz]]], @ssm.get(Set[:foo, :bar, :baz])
+ std::vector<std::string> k4;
+ k4.push_back(":foo");
+ k4.push_back(":bar");
+ k4.push_back(":baz");
+ assertEqual("[[Baz, Set[:foo, :bar]], [Bang, Set[:foo, :bar, :baz]]]", toString(ssm.get_kv(k4)));
+
+ std::cout << std::endl;
+}
+void testBracketBracket() {
+ std::cout << "testBracketBracket" << std::endl;
+
+ //assert_equal ["Foo"], @ssm[Set[1, 2, "fuzz"]]
+ std::vector<std::string> k1;
+ k1.push_back("1");
+ k1.push_back("2");
+ k1.push_back("fuzz");
+ assertEqual("[Foo]", toString(ssm.get_v(k1)));
+
+ //assert_equal ["Baz", "Bang"], @ssm[Set[:foo, :bar, :baz]]
+ std::vector<std::string> k2;
+ k2.push_back(":foo");
+ k2.push_back(":bar");
+ k2.push_back(":baz");
+ assertEqual("[Baz, Bang]", toString(ssm.get_v(k2)));
+
+ std::cout << std::endl;
+}
+
+void testKeyOrder() {
+ std::cout << "testEqualKeys" << std::endl;
+
+ //assert_equal [["Foo", Set[1, 2]]], @ssm.get(Set[2, 1])
+ std::vector<std::string> k1;
+ k1.push_back("2");
+ k1.push_back("1");
+ assertEqual("[[Foo, Set[1, 2]]]", toString(ssm.get_kv(k1)));
+
+ std::cout << std::endl;
+}
+
+void testOrderPreserved() {
+ std::cout << "testOrderPreserved" << std::endl;
+ //@ssm[Set[10, 11, 12]] = 1
+ std::vector<std::string> s1;
+ s1.push_back("10");
+ s1.push_back("11");
+ s1.push_back("12");
+ ssm.put(s1, "1");
+
+ //@ssm[Set[10, 11]] = 2
+ std::vector<std::string> s2;
+ s2.push_back("10");
+ s2.push_back("11");
+ ssm.put(s2, "2");
+
+ //@ssm[Set[11]] = 3
+ std::vector<std::string> s3;
+ s3.push_back("11");
+ ssm.put(s3, "3");
+
+ //@ssm[Set[11, 12]] = 4
+ std::vector<std::string> s4;
+ s4.push_back("11");
+ s4.push_back("12");
+ ssm.put(s4, "4");
+
+ //@ssm[Set[9, 10, 11, 12, 13]] = 5
+ std::vector<std::string> s5;
+ s5.push_back("9");
+ s5.push_back("10");
+ s5.push_back("11");
+ s5.push_back("12");
+ s5.push_back("13");
+ ssm.put(s5, "5");
+
+ //@ssm[Set[10, 13]] = 6
+ std::vector<std::string> s6;
+ s6.push_back("10");
+ s6.push_back("13");
+ ssm.put(s6, "6");
+
+ //assert_equal([[1, Set[10, 11, 12]], [2, Set[10, 11]], [3, Set[11]], [4, Set[11, 12]], [5, Set[9, 10, 11, 12, 13]], [6, Set[10, 13]]], @ssm.get(Set[9, 10, 11, 12, 13]))
+ std::vector<std::string> k1;
+ k1.push_back("9");
+ k1.push_back("10");
+ k1.push_back("11");
+ k1.push_back("12");
+ k1.push_back("13");
+ assertEqual("[[1, Set[10, 11, 12]], [2, Set[10, 11]], [3, Set[11]], [4, Set[11, 12]], [5, Set[9, 10, 11, 12, 13]], [6, Set[10, 13]]]", toString(ssm.get_kv(k1)));
+
+ std::cout << std::endl;
+}
+void testMultipleEqualValues() {
+ std::cout << "testMultipleEqualValues" << std::endl;
+ //@ssm[Set[11, 12]] = 1
+ std::vector<std::string> s1;
+ s1.push_back("11");
+ s1.push_back("12");
+ ssm.put(s1, "1");
+
+ //@ssm[Set[12, 13]] = 2
+ std::vector<std::string> s2;
+ s2.push_back("12");
+ s2.push_back("13");
+ ssm.put(s2, "2");
+
+ //@ssm[Set[13, 14]] = 1
+ std::vector<std::string> s3;
+ s3.push_back("13");
+ s3.push_back("14");
+ ssm.put(s3, "1");
+
+ //@ssm[Set[14, 15]] = 1
+ std::vector<std::string> s4;
+ s4.push_back("14");
+ s4.push_back("15");
+ ssm.put(s4, "1");
+
+ //assert_equal([[1, Set[11, 12]], [2, Set[12, 13]], [1, Set[13, 14]], [1, Set[14, 15]]], @ssm.get(Set[11, 12, 13, 14, 15]))
+ std::vector<std::string> k1;
+ k1.push_back("11");
+ k1.push_back("12");
+ k1.push_back("13");
+ k1.push_back("14");
+ k1.push_back("15");
+ assertEqual("[[1, Set[11, 12]], [2, Set[12, 13]], [1, Set[13, 14]], [1, Set[14, 15]]]", toString(ssm.get_kv(k1)));
+
+ std::cout << std::endl;
+}
+
+int main()
+{
+ std::vector<std::string> s1;
+ s1.push_back("1");
+ s1.push_back("2");
+
+ std::vector<std::string> s2;
+ s2.push_back("2");
+ s2.push_back("3");
+
+ std::vector<std::string> s3;
+ s3.push_back("3");
+ s3.push_back("4");
+
+ ssm.put(s1, "value1");
+ ssm.put(s2, "value2");
+ ssm.put(s3, "value3");
+
+ std::vector<std::string> s4;
+ s4.push_back("1");
+ s4.push_back("2");
+ s4.push_back("3");
+
+ std::vector<std::pair<string, std::vector<std::string> > > fetched(ssm.get_kv(s4));
+
+ std::cout << "PRINTING RESULTS:" << std::endl;
+ for (size_t i = 0, S = fetched.size(); i < S; ++i) {
+ std::cout << fetched[i].first << std::endl;
+ }
+
+ Subset_Map<string, string> ssm2;
+ ssm2.put(s1, "foo");
+ ssm2.put(s2, "bar");
+ ssm2.put(s4, "hux");
+
+ std::vector<std::pair<string, std::vector<std::string> > > fetched2(ssm2.get_kv(s4));
+
+ std::cout << std::endl << "PRINTING RESULTS:" << std::endl;
+ for (size_t i = 0, S = fetched2.size(); i < S; ++i) {
+ std::cout << fetched2[i].first << std::endl;
+ }
+
+ std::cout << "TRYING ON A SELECTOR-LIKE OBJECT" << std::endl;
+
+ Subset_Map<string, string> sel_ssm;
+ std::vector<std::string> target;
+ target.push_back("desk");
+ target.push_back(".wood");
+
+ std::vector<std::string> actual;
+ actual.push_back("desk");
+ actual.push_back(".wood");
+ actual.push_back(".mine");
+
+ sel_ssm.put(target, "has-aquarium");
+ std::vector<std::pair<string, std::vector<std::string> > > fetched3(sel_ssm.get_kv(actual));
+ std::cout << "RESULTS:" << std::endl;
+ for (size_t i = 0, S = fetched3.size(); i < S; ++i) {
+ std::cout << fetched3[i].first << std::endl;
+ }
+
+ std::cout << std::endl;
+
+ // BEGIN PORTED RUBY TESTS FROM /test/sass/util/subset_map_test.rb
+
+ setup();
+ testEqualKeys();
+ testSubsetKeys();
+ testSupersetKeys();
+ testDisjointKeys();
+ testSemiDisjointKeys();
+ testEmptyKeySet();
+ testEmptyKeyGet();
+ testMultipleSubsets();
+ testBracketBracket();
+ testKeyOrder();
+
+ setup();
+ testOrderPreserved();
+
+ setup();
+ testMultipleEqualValues();
+
+ return 0;
+}
+
+string toString(std::vector<std::pair<string, std::vector<std::string>>> v)
+{
+ std::stringstream buffer;
+ buffer << "[";
+ for (size_t i = 0, S = v.size(); i < S; ++i) {
+ buffer << "[" << v[i].first;
+ buffer << ", Set[";
+ for (size_t j = 0, S = v[i].second.size(); j < S; ++j) {
+ buffer << v[i].second[j];
+ if (j < S-1) {
+ buffer << ", ";
+ }
+ }
+ buffer << "]]";
+ if (i < S-1) {
+ buffer << ", ";
+ }
+ }
+ buffer << "]";
+ return buffer.str();
+}
+
+string toString(std::vector<std::string> v)
+{
+ std::stringstream buffer;
+ buffer << "[";
+ for (size_t i = 0, S = v.size(); i < S; ++i) {
+ buffer << v[i];
+ if (i < S-1) {
+ buffer << ", ";
+ }
+ }
+ buffer << "]";
+ return buffer.str();
+}
+
+void assertEqual(string sExpected, string sResult) {
+ std::cout << "Expected: " << sExpected << std::endl;
+ std::cout << "Result: " << sResult << std::endl;
+ assert(sExpected == sResult);
+}
diff --git a/node_modules/node-sass/src/libsass/test/test_superselector.cpp b/node_modules/node-sass/src/libsass/test/test_superselector.cpp
new file mode 100644
index 0000000..bf21c7c
--- /dev/null
+++ b/node_modules/node-sass/src/libsass/test/test_superselector.cpp
@@ -0,0 +1,69 @@
+#include "../ast.hpp"
+#include "../context.hpp"
+#include "../parser.hpp"
+#include <string>
+
+using namespace Sass;
+
+Context ctx = Context(Context::Data());
+
+Compound_Selector* compound_selector(std::string src)
+{ return Parser::from_c_str(src.c_str(), ctx, "", Position()).parse_compound_selector(); }
+
+Complex_Selector* complex_selector(std::string src)
+{ return Parser::from_c_str(src.c_str(), ctx, "", Position()).parse_complex_selector(false); }
+
+void check_compound(std::string s1, std::string s2)
+{
+ std::cout << "Is "
+ << s1
+ << " a superselector of "
+ << s2
+ << "?\t"
+ << compound_selector(s1 + ";")->is_superselector_of(compound_selector(s2 + ";"))
+ << std::endl;
+}
+
+void check_complex(std::string s1, std::string s2)
+{
+ std::cout << "Is "
+ << s1
+ << " a superselector of "
+ << s2
+ << "?\t"
+ << complex_selector(s1 + ";")->is_superselector_of(complex_selector(s2 + ";"))
+ << std::endl;
+}
+
+int main()
+{
+ check_compound(".foo", ".foo.bar");
+ check_compound(".foo.bar", ".foo");
+ check_compound(".foo.bar", "div.foo");
+ check_compound(".foo", "div.foo");
+ check_compound("div.foo", ".foo");
+ check_compound("div.foo", "div.bar.foo");
+ check_compound("p.foo", "div.bar.foo");
+ check_compound(".hux", ".mumble");
+
+ std::cout << std::endl;
+
+ check_complex(".foo ~ .bar", ".foo + .bar");
+ check_complex(".foo .bar", ".foo + .bar");
+ check_complex(".foo .bar", ".foo > .bar");
+ check_complex(".foo .bar > .hux", ".foo.a .bar.b > .hux");
+ check_complex(".foo ~ .bar .hux", ".foo.a + .bar.b > .hux");
+ check_complex(".foo", ".bar .foo");
+ check_complex(".foo", ".foo.a");
+ check_complex(".foo.bar", ".foo");
+ check_complex(".foo .bar .hux", ".bar .hux");
+ check_complex(".foo ~ .bar .hux.x", ".foo.a + .bar.b > .hux.y");
+ check_complex(".foo ~ .bar .hux", ".foo.a + .bar.b > .mumble");
+ check_complex(".foo + .bar", ".foo ~ .bar");
+ check_complex("a c e", "a b c d e");
+ check_complex("c a e", "a b c d e");
+
+ return 0;
+}
+
+
diff --git a/node_modules/node-sass/src/libsass/test/test_unification.cpp b/node_modules/node-sass/src/libsass/test/test_unification.cpp
new file mode 100644
index 0000000..5c663ee
--- /dev/null
+++ b/node_modules/node-sass/src/libsass/test/test_unification.cpp
@@ -0,0 +1,31 @@
+#include "../ast.hpp"
+#include "../context.hpp"
+#include "../parser.hpp"
+#include <string>
+
+using namespace Sass;
+
+Context ctx = Context(Context::Data());
+
+Compound_Selector* selector(std::string src)
+{ return Parser::from_c_str(src.c_str(), ctx, "", Position()).parse_compound_selector(); }
+
+void unify(std::string lhs, std::string rhs)
+{
+ Compound_Selector* unified = selector(lhs + ";")->unify_with(selector(rhs + ";"), ctx);
+ std::cout << lhs << " UNIFIED WITH " << rhs << " =\t" << (unified ? unified->to_string() : "NOTHING") << std::endl;
+}
+
+int main()
+{
+ unify(".foo", ".foo.bar");
+ unify("div:nth-of-type(odd)", "div:first-child");
+ unify("div", "span:whatever");
+ unify("div", "span");
+ unify("foo:bar::after", "foo:bar::first-letter");
+ unify(".foo#bar.hux", ".hux.foo#bar");
+ unify(".foo#bar.hux", ".hux.foo#baz");
+ unify("*:blah:fudge", "p:fudge:blah");
+
+ return 0;
+}