Fixed various errors
This commit is contained in:
parent
4d8069bc65
commit
949cf69c7a
|
@ -1,5 +1,6 @@
|
||||||
#include "error_handling.h"
|
#include "error_handling.h"
|
||||||
|
|
||||||
|
#include <typeinfo>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "phonenumbers/phonenumberutil.h"
|
#include "phonenumbers/phonenumberutil.h"
|
||||||
|
@ -89,4 +90,3 @@ void logInfo(const char* msg) {
|
||||||
(errcode(ERRCODE_SUCCESSFUL_COMPLETION),
|
(errcode(ERRCODE_SUCCESSFUL_COMPLETION),
|
||||||
errmsg("%s", msg)));
|
errmsg("%s", msg)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pg_libphonenumber;
|
||||||
|
--Test phone number parsing
|
||||||
|
select parse_phone_number('555-555-5555', 'US');
|
||||||
|
parse_phone_number
|
||||||
|
--------------------
|
||||||
|
+1 555-555-5555
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
--These two should produce errors because the number is too long.
|
||||||
|
--Produces an error in pg-libphonenumber's code
|
||||||
|
select parse_phone_number('555-555-5555555555', 'US');
|
||||||
|
ERROR: phone number '+1 5555555555555555' is too long
|
||||||
|
DETAIL: National number is too long
|
||||||
|
--Produces an error from libphonenumber
|
||||||
|
select parse_phone_number('555-555-55555555555', 'US');
|
||||||
|
ERROR: unable to parse '555-555-55555555555' as a phone number
|
||||||
|
DETAIL: National number is too long
|
|
@ -3,6 +3,8 @@ CREATE EXTENSION IF NOT EXISTS pg_libphonenumber;
|
||||||
--Test phone number parsing
|
--Test phone number parsing
|
||||||
select parse_phone_number('555-555-5555', 'US');
|
select parse_phone_number('555-555-5555', 'US');
|
||||||
--These two should produce errors because the number is too long.
|
--These two should produce errors because the number is too long.
|
||||||
|
--Produces an error in pg-libphonenumber's code
|
||||||
select parse_phone_number('555-555-5555555555', 'US');
|
select parse_phone_number('555-555-5555555555', 'US');
|
||||||
|
--Produces an error from libphonenumber
|
||||||
select parse_phone_number('555-555-55555555555', 'US');
|
select parse_phone_number('555-555-55555555555', 'US');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue