• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / x / 301

10 Dec 2024 06:19AM UTC coverage: 85.204% (-2.6%) from 87.841%
301

Pull #78

github

web-flow
Merge b830031f4 into 91f0fdf48
Pull Request #78: feat: new package encoding

105 of 161 new or added lines in 3 files covered. (65.22%)

124 existing lines in 29 files now uncovered.

1169 of 1372 relevant lines covered (85.2%)

434.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/json5/types.mbt
1
// Copyright 2024 International Digital Economy Academy
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
///|
16
pub(all) struct Position {
17
  line : Int // 1-based
18
  column : Int // 0-based
19
} derive(Eq, Show)
20

21
///|
22
pub(all) enum ParseErrorData {
23
  InvalidChar(Position, Char)
24
  InvalidEof
25
  InvalidNumber(Position, String)
26
  InvalidIdentEscape(Position)
27
} derive(Eq)
28

29
///|
30
pub(all) type! ParseError ParseErrorData
31

32
///|
33
fn parse_error[X](data : ParseErrorData) -> X!ParseError {
34
  raise ParseError(data)
35✔
35
}
36

37
///|
38
pub fn ParseError::to_string(self : ParseError) -> String {
39
  match self {
35✔
40
    ParseError(InvalidChar({ line, column }, c)) =>
41
      "Invalid character \{c} at line \{line}, column \{column}"
22✔
42
    ParseError(InvalidEof) => "Unexpected end of file"
12✔
43
    ParseError(InvalidNumber({ line, column }, s)) =>
UNCOV
44
      "Invalid number \{s} at line \{line}, column \{column}"
×
45
    ParseError(InvalidIdentEscape({ line, column })) =>
46
      "Invalid escape sequence in identifier at line \{line}, column \{column}"
1✔
47
  }
48
}
49

50
///|
51
pub fn ParseError::output(self : ParseError, logger : Logger) -> Unit {
52
  logger.write_string(ParseError::to_string(self))
35✔
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc