moonbitlang / core

MoonBit's Core library
https://moonbitlang.com/
Apache License 2.0
475 stars 54 forks source link

buffer.expect needs to adapt to the try catch notation #631

Closed Lampese closed 4 days ago

Lampese commented 5 days ago

Now there is a section in buffer_test.mbt:

test "expect method with matching content" {
  let buf = Buffer::make(100)
  buf.write_string("Test")
  buf.expect(content="Test")?
}

test "expect method with non-matching content" {
  let buf = Buffer::make(100)
  buf.write_string("Test")
  buf.expect(content="Test")?
}

This is because the -u parameter of moon will update the expected result, while the return value of buffer.expect is still a Result that cannot be thrown.

Lampese commented 4 days ago

609