diff --git a/mime_example_test.go b/mime_example_test.go new file mode 100644 index 0000000..b6d2b21 --- /dev/null +++ b/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] +}