github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/reference/stdlibs/std/testing.md (about)

     1  ---
     2  id: testing
     3  ---
     4  
     5  # Testing
     6  
     7  ```go
     8  func TestCurrentRealm() string
     9  func TestSkipHeights(count int64)
    10  func TestSetOrigCaller(addr Address)
    11  func TestSetOrigPkgAddr(addr Address)
    12  func TestSetOrigSend(sent, spent Coins)
    13  func TestIssueCoins(addr Address, coins Coins)
    14  ```
    15  
    16  ## TestCurrentRealm
    17  ```go
    18  func TestCurrentRealm() string
    19  ```
    20  Returns the current realm path.
    21  
    22  #### Usage
    23  ```go
    24  currentRealmPath := std.TestCurrentRealm()
    25  ```
    26  ---
    27  
    28  ## TestSkipHeights
    29  ```go
    30  func TestSkipHeights(count int64)
    31  ```
    32  Modifies the block height variable by skipping **count** blocks.
    33  
    34  #### Usage
    35  ```go
    36  std.TestSkipHeights(100)
    37  ```
    38  ---
    39  
    40  ## TestSetOrigCaller
    41  ```go
    42  func TestSetOrigCaller(addr Address)
    43  ```
    44  Sets the current caller of the transaction to **addr**.
    45  
    46  #### Usage
    47  ```go
    48  std.TestSetOrigCaller("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5")
    49  ```
    50  ---
    51  
    52  ## TestSetOrigPkgAddr
    53  ```go
    54  func TestSetOrigPkgAddr(addr Address)
    55  ```
    56  Sets the current realm/package address to **addr**.
    57  
    58  #### Usage
    59  ```go
    60  std.TestSetOrigPkgAddr("g1ecely4gjy0yl6s9kt409ll330q9hk2lj9ls3ec")
    61  ```
    62  ---
    63  
    64  ## TestSetOrigSend
    65  ```go
    66  func TestSetOrigSend(sent, spent Coins)
    67  ```
    68  Sets the sent & spent coins for the current context.
    69  
    70  #### Usage
    71  ```go
    72  std.TestSetOrigSend(sent, spent Coins)
    73  ```
    74  ---
    75  
    76  ## TestIssueCoins
    77  ```go
    78  func TestIssueCoins(addr Address, coins Coins)
    79  ```
    80  Issues testing context **coins** to **addr**.
    81  #### Usage
    82  ```go
    83  issue := std.Coins{{"coin1", 100}, {"coin2", 200}}
    84  addr := "g1ecely4gjy0yl6s9kt409ll330q9hk2lj9ls3ec"
    85  std.TestIssueCoins(addr, issue)
    86  ```
    87  
    88  
    89  
    90  
    91