Former-commit-id: a3c30e0138
This commit is contained in:
Henrique Dias 2017-06-25 10:02:16 +01:00
parent 3a941e4165
commit a692abba9e
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"
)
var m *filemanager.FileManager
func handler(w http.ResponseWriter, r *http.Request) {
@ -21,4 +20,4 @@ func main() {
m = filemanager.New()
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
}

View File

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

View File

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