Browse Source

add example

pull/1/head
andrey1s 2 years ago
parent
commit
af1278edeb
  1. 36
      mime_example_test.go

36
mime_example_test.go

@ -0,0 +1,36 @@
package mime_test
import (
"fmt"
"gitoa.ru/go-4devs/mime"
)
func ExampleMime_String() {
fmt.Printf("%v", mime.TextHTML)
// Output:
// text/html
}
func ExampleMime_Is() {
fmt.Printf("%v\n%v",
mime.TextHTML.Is(mime.ApplicationJSON, mime.ApplicationJavascript),
mime.TextHTML.Is(mime.ApplicationJavascript, mime.TextHTML),
)
// Output:
// false
// true
}
func ExampleMime_ExtTypes() {
fmt.Printf("%v\n%v",
mime.TextHTML.ExtTypes(),
mime.ApplicationJavascript.ExtTypes(),
)
// Output:
// [html htm shtml]
// [js mjs jsm]
}
Loading…
Cancel
Save