|
| 1 | +;;; buttercup-test.el --- Tests for buttercup.el -*-lexical-binding:t-*- |
| 2 | + |
| 3 | +;; Copyright (C) 2016 Jorgen Schaefer <[email protected]> |
| 4 | + |
| 5 | +;; Author: Matus Goljer <[email protected]> |
| 6 | + |
| 7 | +;; This program is free software; you can redistribute it and/or |
| 8 | +;; modify it under the terms of the GNU General Public License |
| 9 | +;; as published by the Free Software Foundation; either version 3 |
| 10 | +;; of the License, or (at your option) any later version. |
| 11 | + |
| 12 | +;; This program is distributed in the hope that it will be useful, |
| 13 | +;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +;; GNU General Public License for more details. |
| 16 | + |
| 17 | +;; You should have received a copy of the GNU General Public License |
| 18 | +;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + |
| 20 | +;;; Code: |
| 21 | + |
| 22 | +(require 'buttercup) |
| 23 | +(require 'buttercup-filesystem) |
| 24 | + |
| 25 | +(describe "With temp fs" |
| 26 | + |
| 27 | + (it "should create multiple files" |
| 28 | + (with-temp-fs '("foo" "bar" "baz") |
| 29 | + (expect "foo" :to-be-file) |
| 30 | + (expect "bar" :to-be-file) |
| 31 | + (expect "baz" :to-be-file))) |
| 32 | + |
| 33 | + (it "should create multiple directories and files" |
| 34 | + (with-temp-fs '("foo/" "bar/" "baz") |
| 35 | + (expect "foo" :to-be-directory) |
| 36 | + (expect "bar" :to-be-directory) |
| 37 | + (expect "baz" :to-be-file))) |
| 38 | + |
| 39 | + (it "should create nested directories" |
| 40 | + (with-temp-fs '("foo/bar" "foo/baz/") |
| 41 | + (expect "foo/bar" :to-be-file) |
| 42 | + (expect "foo/baz" :to-be-directory))) |
| 43 | + |
| 44 | + (it "should create non-empty file" |
| 45 | + (with-temp-fs '(("foo" "amazing content")) |
| 46 | + (expect "foo" :to-contain "amazing content"))) |
| 47 | + |
| 48 | + (it "should create non-empty nested file" |
| 49 | + (with-temp-fs '(("foo/bar" "amazing content")) |
| 50 | + (expect "foo/bar" :to-contain "amazing content"))) |
| 51 | + |
| 52 | + (it "should nest files recursively" |
| 53 | + (with-temp-fs '(("foo" ("bar" "baz" "bam/")) |
| 54 | + ("a/b" ("c" "d/")) |
| 55 | + ("x" (("y" ("z")) |
| 56 | + "w"))) |
| 57 | + (expect "foo/bar" :to-be-file) |
| 58 | + (expect "foo/baz" :to-be-file) |
| 59 | + (expect "foo/bam" :to-be-directory) |
| 60 | + (expect "a/b/c" :to-be-file) |
| 61 | + (expect "a/b/d" :to-be-directory) |
| 62 | + (expect "x/y/z" :to-be-file) |
| 63 | + (expect "x/w" :to-be-file)))) |
0 commit comments