Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add validator: StringRuneCountBetween() and StringBytesBetween() instead StringLenBetween() #1

Closed
wants to merge 7 commits into from

Conversation

ryodocx
Copy link
Owner

@ryodocx ryodocx commented Jun 17, 2022

Summary

  • In this PullRequest, add validator in order to count string length correctly.
  • Current, StringLenBetween() count byte length.
  • For example Japanese, 1 character mean 2 bytes.
    • Sometimes, improper validation implements in terraform-provider via this behavior

What's changes?

  • add StringRuneCountBetween() for count string length
  • add StringBytesBetween() for count byte length (it's just copy of StringLenBetween())
  • add validation for parameters(min, max)
  • add test

Related issues


test viewpoint

テスト観点メモ

    • string型: OK
    • string以外の型: NG
  • 閾値の数値
    • 負数: NG
    • 0: OK
    • 正数: OK
  • 閾値の関係
    • Min = Max: OK
    • Min < Max: OK
    • Min > Max: NG
  • 閾値(Min)
    • 文字数(Byte数)より小さい: OK
    • 文字数(Byte数)と同じ: OK
    • 文字数(Byte数)より大きい: NG
  • 閾値(Max)
    • 文字数(Byte数)より小さい: NG
    • 文字数(Byte数)と同じ: OK
    • 文字数(Byte数)より大きい: OK
  • 文字種
    • シングルバイト文字(ASCII)
      • 空白
      • 制御文字
      • 図形文字(通常文字)
    • 2バイト文字
    • 3バイト文字
    • 4バイト文字

@ryodocx ryodocx changed the title add validator: StringRuneCountBetween and StringBytesBetween add validator: StringRuneCountBetween() and StringBytesBetween() instead StringLenBetween() Jun 19, 2022
@ryodocx
Copy link
Owner Author

ryodocx commented Jun 19, 2022

move to: hashicorp#985

@ryodocx ryodocx closed this Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant