History

tests: allow specifying rune as hex/dec number with -r

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit d8004221 parent bae955e1 file · +9 −4Browse files

Unified · Split

test.h+9−4
@@ -1,3 +1,5 @@
1#include <ctype.h>
2
1static void3static void
2printusage(Otfile *f)4printusage(Otfile *f)
3{5{
@@ -185,7 +187,7 @@ glypherr: · 181 unmodified lines
185 highlight = strtol(EARGF(usage(&out)), nil, 0); \187 highlight = strtol(EARGF(usage(&out)), nil, 0); \
186 break; \188 break; \
187 case 'i': \189 case 'i': \
188 if(rune != Runeerror){ \190 if(rune != NoRune){ \
189errboth: \191errboth: \
190 out.print(out.aux, "can't specify both rune and glyph\n"); \192 out.print(out.aux, "can't specify both rune and glyph\n"); \
191 usage(&out); \193 usage(&out); \
@@ -198,14 +200,17 @@ errboth: \ · 6 unmodified lines
198 case 'p': \200 case 'p': \
199 ppem = strtod(EARGF(usage(&out)), nil); \201 ppem = strtod(EARGF(usage(&out)), nil); \
200 break; \202 break; \
201 case 'r': \203 case 'r': { \
204 char *s = EARGF(usage(&out)); \
202 if(gind >= 0) \205 if(gind >= 0) \
203 goto errboth; \206 goto errboth; \
204 if(chartorune(&rune, EARGF(usage(&out))) == 1 && rune == Runeerror){ \207 if(isdigit(*s) && strlen(s) > 1) \
208 rune = strtol(s, nil, 0); \
209 else if(chartorune(&rune, s) == 1 && rune == Runeerror){ \
205 out.print(out.aux, "invalid rune\n"); \210 out.print(out.aux, "invalid rune\n"); \
206 usage(&out); \211 usage(&out); \
207 } \212 } \
208 break; \213 } break; \
209 case 'R': \214 case 'R': \
210 runesonly++; \215 runesonly++; \
211 break; \216 break; \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t