Commit bbd5032f by Aaron Leung

Adding a unit test and fixing some bugs.

parent cefe1e26
#header > #leftpane > [data-ur-tabs-component="button"] {
> div {
padding: 10px;
}
> div:after {
content: "▼";
float: right;
}
&[data-ur-state="enabled"] > div:after {
content: "▲";
float: right;
}
}
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Sass { namespace Sass {
Document::Document(char* _path, char* _source) { Document::Document(char* _path, char* _source) {
path = _path; path = _path;
if (!source) { if (!_source) {
std::FILE *f; std::FILE *f;
f = std::fopen(path, "rb"); f = std::fopen(path, "rb");
// if (!f) { // if (!f) {
...@@ -14,7 +14,6 @@ namespace Sass { ...@@ -14,7 +14,6 @@ namespace Sass {
std::fseek(f, 0, SEEK_END); std::fseek(f, 0, SEEK_END);
int len = std::ftell(f); int len = std::ftell(f);
std::rewind(f); std::rewind(f);
// char *buf = (char *)malloc(len * sizeof(char) + 1);
source = new char[len + 1]; source = new char[len + 1];
std::fread(source, sizeof(char), len, f); std::fread(source, sizeof(char), len, f);
source[len] = '\0'; source[len] = '\0';
...@@ -24,4 +23,7 @@ namespace Sass { ...@@ -24,4 +23,7 @@ namespace Sass {
source = _source; source = _source;
} }
} }
Document::~Document() {
delete [] source;
}
} }
\ No newline at end of file
#include <vector>
#include "node.hpp" #include "node.hpp"
namespace Sass { namespace Sass {
...@@ -12,5 +11,6 @@ namespace Sass { ...@@ -12,5 +11,6 @@ namespace Sass {
vector<Node> statements; vector<Node> statements;
Document(char* _path, char* _source = 0); Document(char* _path, char* _source = 0);
~Document();
}; };
} }
\ No newline at end of file
#include <cstdio>
#include "document.hpp"
using namespace Sass;
int main(int argc, char* argv[]) {
Document doc(argv[1], 0);
char* src = doc.source;
printf("FILE BEGINS ON NEXT LINE\n");
while (*src) std::putchar(*(src++));
printf("<EOF>\n");
return 0;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment