Skip to content

Commit deea2f5

Browse files
committed
fix: naughty echo
1 parent b960561 commit deea2f5

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/gserde.gleam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn main() {
5353

5454
pub fn process_single(src_filename: String, is_debug) {
5555
bool.guard(!is_debug, Nil, fn() {
56-
echo #("Processing", src_filename)
56+
io.println("Processing: " <> src_filename)
5757
Nil
5858
})
5959

src/internal/deserializer.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import common.{decoder_name_of_t}
22
import glance
33
import gleam/int
4+
import gleam/io
45
import gleam/list
56
import gleam/option
67
import gleam/string
@@ -64,7 +65,7 @@ fn gen_decoder(typ) {
6465
)
6566
}
6667
x -> {
67-
echo #("warning: unsupported decoding", x)
68+
io.println_error(string.inspect(#("warning: unsupported decoding", x)))
6869
gens.Direct("todo")
6970
}
7071
}

test/gserde_test.gleam

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub fn main() {
1111

1212
const foo_module = "
1313
import gleam/option.{type Option, Some}
14+
import gleam/io
1415
1516
pub type FooJson {
1617
Foo(
@@ -48,6 +49,7 @@ pub type BarJson {
4849
const foo_json_test = "
4950
import gleam/io
5051
import gleam/result
52+
import gleam/string
5153
import internal/foo
5254
import internal/foo_json
5355
@@ -58,15 +60,14 @@ pub fn main() {
5860
|> foo_json.to_string
5961
6062
let foo_b = foo_str |> foo_json.from_string |> result.lazy_unwrap(fn() {
61-
echo \"parse error calling foo_json.from_string\"
6263
panic
6364
})
6465
6566
case foo_a == foo_b {
6667
True -> io.println(\"foos equal\")
6768
False -> {
68-
echo #(\"a\", foo_a)
69-
echo #(\"b\", foo_b)
69+
io.println(string.inspect(#(\"a\", foo_a)))
70+
io.println(string.inspect(#(\"b\", foo_b)))
7071
panic as \"not equal\"
7172
}
7273
}
@@ -78,6 +79,7 @@ pub fn main() {
7879
const bar_json_test = "
7980
import gleam/io
8081
import gleam/result
82+
import gleam/string
8183
import internal/foo
8284
import internal/bar
8385
import internal/bar_json
@@ -91,15 +93,15 @@ pub fn main() {
9193
|> bar_json.to_string
9294
9395
let bar_b = bar_str |> bar_json.from_string |> result.lazy_unwrap(fn() {
94-
echo \"parse error calling bar_json.from_string\"
96+
io.println_error(\"parse error calling bar_json.from_string\")
9597
panic
9698
})
9799
98100
case bar_a == bar_b {
99101
True -> io.println(\"bars equal\")
100102
False -> {
101-
echo #(\"a\", bar_a)
102-
echo #(\"b\", bar_b)
103+
io.println_error(string.inspect(#(\"a\", bar_a)))
104+
io.println_error(string.inspect(#(\"b\", bar_b)))
103105
panic as \"not equal\"
104106
}
105107
}

0 commit comments

Comments
 (0)