1 # Tests for Antimony writer.
3 write_antimony 169 standard_output
4 write_newline_and_flush_stream standard_output
7 write_antimony @foo standard_output
8 write_newline_and_flush_stream standard_output
10 write_antimony "hello" standard_output
11 write_newline_and_flush_stream standard_output
13 var items = auto-words 3
14 var bar = intern "bar"
15 set-word @items 0 @bar
16 set-word @items 1 "hello"
17 var barhello = array 2 @items
18 write_antimony @barhello standard_output
19 write_newline_and_flush_stream standard_output
21 set-word @items 0 @foo
22 set-word @items 1 @barhello
23 var foo_barhello = array 2 @items
24 write_antimony @foo_barhello standard_output
25 write_newline_and_flush_stream standard_output
27 var empty_array = array 0 @items
28 var empty_block = block @empty_array
29 write_antimony @empty_block standard_output
30 write_newline_and_flush_stream standard_output
32 set-word @items 0 @bar
33 var bar_array = array 1 @items
34 var bar_block = block @bar_array
35 write_antimony @bar_block standard_output
36 write_newline_and_flush_stream standard_output
38 set-word @items 0 (intern "if")
39 set-word @items 1 @foo
40 set-word @items 2 @bar_block
41 var if_foo_bar = array 3 @items
42 write_antimony @if_foo_bar standard_output
43 write_newline_and_flush_stream standard_output
45 set-word @items 0 @if_foo_bar
46 var test_body = block (array 1 @items)
47 set-word @items 0 #`function
48 set-word @items 1 (intern "test")
49 set-word @items 2 @test_body
50 var function_test = array 3 @items
51 write_antimony @function_test standard_output
52 write_newline_and_flush_stream standard_output
54 var all_bytes_builder = (blob_builder)
59 blob_builder_append_byte @all_bytes_builder i
62 var all_bytes = blob_builder_to_blob @all_bytes_builder
63 write_antimony @all_bytes standard_output
64 write_newline_and_flush_stream standard_output
66 var foons = get_namespace @foo
67 var foobar = namespace_intern @foons "bar"
68 write_antimony @foobar standard_output
69 write_newline_and_flush_stream standard_output
71 var example_comment = make_comment "# " "example comment"
72 write_antimony @example_comment standard_output
73 write_newline_and_flush_stream standard_output