| 128 | } |
| 129 | |
| 130 | func TestHi(t *testing.T) { |
| 131 | // t.Parallel() |
| 132 | path := "_examples/hi" |
| 133 | testPkg(t, pkg{ |
| 134 | path: path, |
| 135 | lang: features[path], |
| 136 | cmd: "build", |
| 137 | extras: nil, |
| 138 | want: []byte(`hi from go |
| 139 | hello you from go |
| 140 | working... |
| 141 | worked for 2 hours |
| 142 | working... |
| 143 | working... |
| 144 | worked for 4 hours |
| 145 | --- doc(hi)... |
| 146 | |
| 147 | package hi exposes a few Go functions to be wrapped and used from Python. |
| 148 | |
| 149 | |
| 150 | --- hi.Universe: 42 |
| 151 | --- hi.Version: 0.1 |
| 152 | --- hi.Debug(): False |
| 153 | --- hi.Set_Debug(true) |
| 154 | --- hi.Debug(): True |
| 155 | --- hi.Set_Debug(false) |
| 156 | --- hi.Debug(): False |
| 157 | --- hi.Anon(): hi.Person{Name="<nobody>", Age=1} |
| 158 | --- new anon: hi.Person{Name="you", Age=24} |
| 159 | --- hi.Set_Anon(hi.NewPerson('you', 24))... |
| 160 | --- hi.Anon(): hi.Person{Name="you", Age=24} |
| 161 | --- doc(hi.Hi)... |
| 162 | Hi() |
| 163 | |
| 164 | Hi prints hi from Go |
| 165 | |
| 166 | --- hi.Hi()... |
| 167 | --- doc(hi.Hello)... |
| 168 | Hello(str s) |
| 169 | |
| 170 | Hello prints a greeting from Go |
| 171 | |
| 172 | --- hi.Hello('you')... |
| 173 | --- doc(hi.Add)... |
| 174 | Add(int i, int j) int |
| 175 | |
| 176 | Add returns the sum of its arguments. |
| 177 | |
| 178 | --- hi.Add(1, 41)... |
| 179 | 42 |
| 180 | --- hi.Concat('4', '2')... |
| 181 | 42 |
| 182 | --- hi.LookupQuestion(42)... |
| 183 | Life, the Universe and Everything |
| 184 | --- hi.LookupQuestion(12)... |
| 185 | caught: Wrong answer: 12 != 42 |
| 186 | --- doc(hi.Person): |
| 187 | Person is a simple struct |