Blame test/test_specificity.cpp
|
Packit |
bfcc33 |
#include "../ast.hpp"
|
|
Packit |
bfcc33 |
#include "../context.hpp"
|
|
Packit |
bfcc33 |
#include "../parser.hpp"
|
|
Packit |
bfcc33 |
#include <string>
|
|
Packit |
bfcc33 |
#include <iostream>
|
|
Packit |
bfcc33 |
|
|
Packit |
bfcc33 |
using namespace Sass;
|
|
Packit |
bfcc33 |
|
|
Packit |
bfcc33 |
Context ctx = Context::Data();
|
|
Packit |
bfcc33 |
|
|
Packit |
bfcc33 |
Selector* selector(std::string src)
|
|
Packit |
bfcc33 |
{ return Parser::from_c_str(src.c_str(), ctx, "", Position()).parse_selector_list(); }
|
|
Packit |
bfcc33 |
|
|
Packit |
bfcc33 |
void spec(std::string sel)
|
|
Packit |
bfcc33 |
{ std::cout << sel << "\t::\t" << selector(sel + ";")->specificity() << std::endl; }
|
|
Packit |
bfcc33 |
|
|
Packit |
bfcc33 |
int main()
|
|
Packit |
bfcc33 |
{
|
|
Packit |
bfcc33 |
spec("foo bar hux");
|
|
Packit |
bfcc33 |
spec(".foo .bar hux");
|
|
Packit |
bfcc33 |
spec("#foo .bar[hux='mux']");
|
|
Packit |
bfcc33 |
spec("a b c d e f");
|
|
Packit |
bfcc33 |
|
|
Packit |
bfcc33 |
return 0;
|
|
Packit |
bfcc33 |
}
|