pull/144/head
Henrique Dias 2017-06-25 10:02:16 +01:00
parent 5c5fe0102b
commit a3c30e0138
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
4 changed files with 32 additions and 29 deletions

4
README.md Normal file
View File

@ -0,0 +1,4 @@
# filemanager
[![Build](https://img.shields.io/travis/hacdias/filemanager.svg?style=flat-square)](https://travis-ci.org/hacdias/filemanager)
[![Go Report Card](https://goreportcard.com/badge/github.com/hacdias/filemanager?style=flat-square)](https://goreportcard.com/report/hacdias/filemanager)

View File

@ -7,7 +7,6 @@ import (
"github.com/hacdias/filemanager" "github.com/hacdias/filemanager"
) )
var m *filemanager.FileManager var m *filemanager.FileManager
func handler(w http.ResponseWriter, r *http.Request) { func handler(w http.ResponseWriter, r *http.Request) {

View File

@ -8,43 +8,43 @@ type hasRuneTest struct {
} }
var testHasRune = []hasRuneTest{ var testHasRune = []hasRuneTest{
hasRuneTest{ {
File: []byte(`--- File: []byte(`---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed auctor libero eget ante fermentum commodo. Sed auctor libero eget ante fermentum commodo.
---`), ---`),
Return: true, Return: true,
}, },
hasRuneTest{ {
File: []byte(`+++ File: []byte(`+++
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed auctor libero eget ante fermentum commodo. Sed auctor libero eget ante fermentum commodo.
+++`), +++`),
Return: true, Return: true,
}, },
hasRuneTest{ {
File: []byte(`{ File: []byte(`{
"json": "Lorem ipsum dolor sit amet" "json": "Lorem ipsum dolor sit amet"
}`), }`),
Return: true, Return: true,
}, },
hasRuneTest{ {
File: []byte(`+`), File: []byte(`+`),
Return: false, Return: false,
}, },
hasRuneTest{ {
File: []byte(`++`), File: []byte(`++`),
Return: false, Return: false,
}, },
hasRuneTest{ {
File: []byte(`-`), File: []byte(`-`),
Return: false, Return: false,
}, },
hasRuneTest{ {
File: []byte(`--`), File: []byte(`--`),
Return: false, Return: false,
}, },
hasRuneTest{ {
File: []byte(`Lorem ipsum`), File: []byte(`Lorem ipsum`),
Return: false, Return: false,
}, },

View File

@ -8,14 +8,14 @@ type interfaceToBool struct {
} }
var testIsMap = []*interfaceToBool{ var testIsMap = []*interfaceToBool{
&interfaceToBool{"teste", false}, {"teste", false},
&interfaceToBool{453478, false}, {453478, false},
&interfaceToBool{-984512, false}, {-984512, false},
&interfaceToBool{true, false}, {true, false},
&interfaceToBool{map[string]bool{}, true}, {map[string]bool{}, true},
&interfaceToBool{map[int]bool{}, true}, {map[int]bool{}, true},
&interfaceToBool{map[interface{}]bool{}, true}, {map[interface{}]bool{}, true},
&interfaceToBool{[]string{}, false}, {[]string{}, false},
} }
func TestIsMap(t *testing.T) { func TestIsMap(t *testing.T) {
@ -27,17 +27,17 @@ func TestIsMap(t *testing.T) {
} }
var testIsSlice = []*interfaceToBool{ var testIsSlice = []*interfaceToBool{
&interfaceToBool{"teste", false}, {"teste", false},
&interfaceToBool{453478, false}, {453478, false},
&interfaceToBool{-984512, false}, {-984512, false},
&interfaceToBool{true, false}, {true, false},
&interfaceToBool{map[string]bool{}, false}, {map[string]bool{}, false},
&interfaceToBool{map[int]bool{}, false}, {map[int]bool{}, false},
&interfaceToBool{map[interface{}]bool{}, false}, {map[interface{}]bool{}, false},
&interfaceToBool{[]string{}, true}, {[]string{}, true},
&interfaceToBool{[]int{}, true}, {[]int{}, true},
&interfaceToBool{[]bool{}, true}, {[]bool{}, true},
&interfaceToBool{[]interface{}{}, true}, {[]interface{}{}, true},
} }
func TestIsSlice(t *testing.T) { func TestIsSlice(t *testing.T) {