---
cases:
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes("")
        }
    note: units_parse_bytes/failure
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: no byte amount provided"
    strict_error: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes("GB")
        }
    note: units_parse_bytes/failure
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: no byte amount provided"
    strict_error: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes("foo")
        }
    note: units_parse_bytes/failure
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: no byte amount provided"
    strict_error: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes("0.0.0")
        }
    note: units_parse_bytes/failure
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: could not parse byte amount to a number"
    strict_error: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes(".5.2")
        }
    note: units_parse_bytes/failure
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: could not parse byte amount to a number"
    strict_error: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes("100 kb")
        }
    note: units_parse_bytes/failure
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: spaces not allowed in resource strings"
    strict_error: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes(" 327MiB ")
        }
    note: units_parse_bytes/failure
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: spaces not allowed in resource strings"
    strict_error: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse_bytes("10e10000000EiB")
        }
    note: units_parse_bytes/exponent too large
    query: data.test.p = x
    want_error_code: eval_builtin_error
    want_error: "units.parse_bytes: exponent too large"
    strict_error: true
