+1
-1
gleam.toml
+1
-1
gleam.toml
+12
src/xmleam.gleam
+12
src/xmleam.gleam
···
46
46
}
47
47
48
48
io.println(result.unwrap(document, "ERROR"))
49
+
50
+
let document = {
51
+
xml_builder.new()
52
+
|> xml_builder.cdata_tag(
53
+
"link",
54
+
"<a href=\"https://example.com\"> link </a>",
55
+
)
56
+
|> xml_builder.end_xml
57
+
|> result.unwrap("ERROR")
58
+
}
59
+
60
+
io.debug(document)
49
61
}
+11
-1
test/xmleam_test.gleam
+11
-1
test/xmleam_test.gleam
···
1
+
import gleam/result
1
2
import gleeunit
2
3
import gleeunit/should
3
4
import xmleam/xml_builder.{
4
5
Opt, block_tag, end_xml, new, option_block_tag, option_content_tag, option_tag,
5
6
tag,
6
7
}
7
-
import gleam/result
8
8
9
9
pub fn main() {
10
10
gleeunit.main()
···
14
14
pub fn hello_world_test() {
15
15
1
16
16
|> should.equal(1)
17
+
}
18
+
19
+
pub fn xml_builder_cdata_test() {
20
+
xml_builder.new()
21
+
|> xml_builder.cdata_tag("link", "<a href=\"https://example.com\"> link </a>")
22
+
|> xml_builder.end_xml
23
+
|> result.unwrap("ERROR")
24
+
|> should.equal(
25
+
"<link> \n<![CDATA[\n \t<a href=\"https://example.com\"> link </a>\n]]> \n</link> \n",
26
+
)
17
27
}
18
28
19
29
///Test all of the functions