Documentation ¶
Overview ¶
Package testconversions provides functions to to create arbitrary values of package safehtml types for use by tests only. Note that the created values may violate type contracts.
These functions are useful when types are constructed in a manner where using the package safehtml API is too inconvenient. Please use the package safehtml API whenever possible; there is value in having tests reflect common usage. Using the package safehtml API also avoids, by design, non-contract complying instances from being created.
Index ¶
- func MakeHTMLForTest(s string) safehtml.HTML
- func MakeIdentifierForTest(s string) safehtml.Identifier
- func MakeScriptForTest(s string) safehtml.Script
- func MakeStyleForTest(s string) safehtml.Style
- func MakeStyleSheetForTest(s string) safehtml.StyleSheet
- func MakeTrustedResourceURLForTest(s string) safehtml.TrustedResourceURL
- func MakeURLForTest(s string) safehtml.URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeHTMLForTest ¶
MakeHTMLForTest converts a plain string into a HTML. This function must only be used in tests.
func MakeIdentifierForTest ¶
func MakeIdentifierForTest(s string) safehtml.Identifier
MakeIdentifierForTest converts a plain string into an Identifier. This function must only be used in tests.
func MakeScriptForTest ¶
MakeScriptForTest converts a plain string into a Script. This function must only be used in tests.
func MakeStyleForTest ¶
MakeStyleForTest converts a plain string into a Style. This function must only be used in tests.
func MakeStyleSheetForTest ¶
func MakeStyleSheetForTest(s string) safehtml.StyleSheet
MakeStyleSheetForTest converts a plain string into a StyleSheet. This function must only be used in tests.
func MakeTrustedResourceURLForTest ¶
func MakeTrustedResourceURLForTest(s string) safehtml.TrustedResourceURL
MakeTrustedResourceURLForTest converts a plain string into a TrustedResourceURL. This function must only be used in tests.
func MakeURLForTest ¶
MakeURLForTest converts a plain string into a URL. This function must only be used in tests.
Types ¶
This section is empty.