Created
February 9, 2014 18:14
-
-
Save jamiebuilds/8903415 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.3.0.rc.3) | |
// Compass (v1.0.0.alpha.18) | |
// SassyJSON (v1.1.2) | |
// ---- | |
@import "SassyJSON"; | |
$bc-data-tests: ( depth: 0, parents: (), current: null, result: () ); | |
@function bc-tree-branch($data) { | |
$depth : map-get( $data, depth ); | |
$parents : map-get( $data, parents ); | |
$current : map-get( $data, current ); | |
$result : map-get( $data, result ); | |
$depth: $depth + 1; | |
@if $depth > 1 { | |
$parents: append($parents, $current); | |
} | |
$current: (); | |
@return ( depth: $depth, parents: $parents, current: $current, result: $result ); | |
}; | |
@function bc-tree-merge($data, $name) { | |
$depth : map-get( $data, depth ); | |
$parents : map-get( $data, parents ); | |
$current : map-get( $data, current ); | |
$result : map-get( $data, result ); | |
@if $depth > 1 { | |
$length: length($parents); | |
$index: 1; | |
$next: (); | |
@each $parent in $parents { | |
@if $index == $length { | |
$prev: map-get($parent, $name); | |
@if $prev == null { | |
$prev: (); | |
} | |
$parent: map-merge($parent, ( $name: append($prev, $current) )); | |
$current: $parent; | |
} | |
@else { | |
$next: append($next, $parent); | |
} | |
$index: $index + 1; | |
} | |
$parents: $next; | |
} | |
@else { | |
$prev: map-get($result, $name); | |
@if $prev == null { | |
$prev: (); | |
} | |
$result: map-merge($result, ($name: append($prev, $current)) ); | |
$current: (); | |
$parents: (); | |
} | |
$depth: $depth - 1; | |
@return ( depth: $depth, parents: $parents, current: $current, result: $result ); | |
}; | |
@function bc-tree-current ($data, $current) { | |
@return map-merge($data, ( | |
current: map-merge( map-get($data, current), $current ) | |
)); | |
} | |
@mixin describe ($title) { | |
$bc-data-tests: bc-tree-branch($bc-data-tests) !global; | |
$bc-data-tests: bc-tree-current($bc-data-tests, ( | |
title: $title | |
)) !global; | |
#{$title} { | |
@content; | |
} | |
$bc-data-tests: bc-tree-merge($bc-data-tests, "modules") !global; | |
} | |
@mixin it ($statement) { | |
$bc-data-tests: bc-tree-branch($bc-data-tests) !global; | |
$bc-data-tests: bc-tree-current($bc-data-tests, ( | |
statement: $statement | |
)) !global; | |
#{$statement} { | |
@content; | |
} | |
$bc-data-tests: bc-tree-merge($bc-data-tests, "tests") !global; | |
} | |
@mixin expect($expression) { | |
$bc-data-tests: bc-tree-branch($bc-data-tests) !global; | |
$bc-data-tests: bc-tree-current($bc-data-tests, ( | |
expression: $expression | |
)) !global; | |
Expected: $expression; | |
$bc-data-tests: bc-tree-merge($bc-data-tests, "assertions") !global; | |
} | |
@include describe('A Test') { | |
@include it("should do something") { | |
@include expect(true to be true); | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('A Test') { | |
@include it("should do something") { | |
@include expect(true to be true); | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('A Test') { | |
@include it("should do something") { | |
@include expect(true to be true); | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('A Test') { | |
@include it("should do something") { | |
@include expect(true to be true); | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('A Test') { | |
@include it("should do something") { | |
@include expect(true to be true); | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
@include it('should do something else') { | |
@include expect(true to be true); | |
} | |
} | |
} | |
@include describe('Another Test') { | |
@include describe('Yet Another Test') { | |
@include it('should do something else') { | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
@include expect(true to be true); | |
} | |
} | |
} | |
/** | |
* #{json-encode( map-get($bc-data-tests, result) )} | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A Test should do something { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
} | |
A Test should do something { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
} | |
A Test should do something { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
} | |
A Test should do something { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
} | |
A Test should do something { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
} | |
Another Test Yet Another Test should do something else { | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
Expected: true to be true; | |
} | |
/** | |
* {"modules": [{"title": "A Test", "tests": [{"statement": "should do something", "assertions": [{"expression": [true, "to", "be", true]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}]}]}]}, {"title": "A Test", "tests": [{"statement": "should do something", "assertions": [{"expression": [true, "to", "be", true]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}]}]}]}, {"title": "A Test", "tests": [{"statement": "should do something", "assertions": [{"expression": [true, "to", "be", true]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}]}]}]}, {"title": "A Test", "tests": [{"statement": "should do something", "assertions": [{"expression": [true, "to", "be", true]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}]}]}]}, {"title": "A Test", "tests": [{"statement": "should do something", "assertions": [{"expression": [true, "to", "be", true]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}, {"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}]}]}]}, {"title": "Another Test", "modules": [{"title": "Yet Another Test", "tests": [{"statement": "should do something else", "assertions": [{"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}, {"expression": [true, "to", "be", true]}]}]}]}]} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment