Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
4edf461a
Commit
4edf461a
authored
May 07, 2015
by
Jacob Potter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exercise some more stuff in the test suite.
parent
3a477262
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
87 additions
and
26 deletions
+87
-26
test-suite/djinni/client_interface.djinni
test-suite/djinni/client_interface.djinni
+2
-1
test-suite/djinni/test.djinni
test-suite/djinni/test.djinni
+1
-0
test-suite/generated-src/cpp/client_interface.hpp
test-suite/generated-src/cpp/client_interface.hpp
+2
-1
test-suite/generated-src/cpp/client_returned_record.hpp
test-suite/generated-src/cpp/client_returned_record.hpp
+5
-1
test-suite/generated-src/cpp/test_helpers.hpp
test-suite/generated-src/cpp/test_helpers.hpp
+2
-0
test-suite/generated-src/java/com/dropbox/djinni/test/ClientInterface.java
...ted-src/java/com/dropbox/djinni/test/ClientInterface.java
+1
-1
test-suite/generated-src/java/com/dropbox/djinni/test/ClientReturnedRecord.java
...rc/java/com/dropbox/djinni/test/ClientReturnedRecord.java
+9
-1
test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java
...nerated-src/java/com/dropbox/djinni/test/TestHelpers.java
+2
-0
test-suite/generated-src/jni/NativeClientInterface.cpp
test-suite/generated-src/jni/NativeClientInterface.cpp
+4
-2
test-suite/generated-src/jni/NativeClientInterface.hpp
test-suite/generated-src/jni/NativeClientInterface.hpp
+2
-2
test-suite/generated-src/jni/NativeClientReturnedRecord.cpp
test-suite/generated-src/jni/NativeClientReturnedRecord.cpp
+5
-2
test-suite/generated-src/jni/NativeClientReturnedRecord.hpp
test-suite/generated-src/jni/NativeClientReturnedRecord.hpp
+2
-1
test-suite/generated-src/jni/NativeTestHelpers.cpp
test-suite/generated-src/jni/NativeTestHelpers.cpp
+10
-0
test-suite/generated-src/objc/DBClientInterface.h
test-suite/generated-src/objc/DBClientInterface.h
+2
-1
test-suite/generated-src/objc/DBClientInterface.mm
test-suite/generated-src/objc/DBClientInterface.mm
+3
-2
test-suite/generated-src/objc/DBClientReturnedRecord+Private.mm
...uite/generated-src/objc/DBClientReturnedRecord+Private.mm
+4
-2
test-suite/generated-src/objc/DBClientReturnedRecord.h
test-suite/generated-src/objc/DBClientReturnedRecord.h
+4
-1
test-suite/generated-src/objc/DBClientReturnedRecord.mm
test-suite/generated-src/objc/DBClientReturnedRecord.mm
+7
-0
test-suite/generated-src/objc/DBTestHelpers.h
test-suite/generated-src/objc/DBTestHelpers.h
+2
-0
test-suite/generated-src/objc/DBTestHelpers.mm
test-suite/generated-src/objc/DBTestHelpers.mm
+6
-0
test-suite/handwritten-src/cpp/test_helpers.cpp
test-suite/handwritten-src/cpp/test_helpers.cpp
+4
-2
test-suite/handwritten-src/java/com/dropbox/djinni/test/ClientInterfaceImpl.java
...src/java/com/dropbox/djinni/test/ClientInterfaceImpl.java
+2
-2
test-suite/handwritten-src/objc/impl/DBClientInterfaceImpl.mm
...-suite/handwritten-src/objc/impl/DBClientInterfaceImpl.mm
+2
-2
test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj
test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj
+4
-2
No files found.
test-suite/djinni/client_interface.djinni
View file @
4edf461a
client_returned_record = record {
record_id: i64;
content: string;
misc: optional<string>;
}
client_interface = interface +j +o {
# Returns record of given string
get_record(record_id: i64, utf8string: string): client_returned_record;
get_record(record_id: i64, utf8string: string
, misc: optional<string>
): client_returned_record;
}
test-suite/djinni/test.djinni
View file @
4edf461a
...
...
@@ -19,6 +19,7 @@ test_helpers = interface +c {
static check_client_interface_nonascii(i: client_interface);
static check_enum_map(m: map<color, string>);
static check_enum(c: color);
static token_id(t: token): token;
static create_cpp_token(): token;
...
...
test-suite/generated-src/cpp/client_interface.hpp
View file @
4edf461a
...
...
@@ -5,6 +5,7 @@
#include "client_returned_record.hpp"
#include <cstdint>
#include <experimental/optional>
#include <string>
class
ClientInterface
{
...
...
@@ -12,5 +13,5 @@ public:
virtual
~
ClientInterface
()
{}
/** Returns record of given string */
virtual
ClientReturnedRecord
get_record
(
int64_t
record_id
,
const
std
::
string
&
utf8string
)
=
0
;
virtual
ClientReturnedRecord
get_record
(
int64_t
record_id
,
const
std
::
string
&
utf8string
,
const
std
::
experimental
::
optional
<
std
::
string
>
&
misc
)
=
0
;
};
test-suite/generated-src/cpp/client_returned_record.hpp
View file @
4edf461a
...
...
@@ -4,16 +4,20 @@
#pragma once
#include <cstdint>
#include <experimental/optional>
#include <string>
#include <utility>
struct
ClientReturnedRecord
final
{
int64_t
record_id
;
std
::
string
content
;
std
::
experimental
::
optional
<
std
::
string
>
misc
;
ClientReturnedRecord
(
int64_t
record_id
,
std
::
string
content
)
std
::
string
content
,
std
::
experimental
::
optional
<
std
::
string
>
misc
)
:
record_id
(
std
::
move
(
record_id
))
,
content
(
std
::
move
(
content
))
,
misc
(
std
::
move
(
misc
))
{}
};
test-suite/generated-src/cpp/test_helpers.hpp
View file @
4edf461a
...
...
@@ -52,6 +52,8 @@ public:
static
void
check_enum_map
(
const
std
::
unordered_map
<
color
,
std
::
string
>
&
m
);
static
void
check_enum
(
color
c
);
static
std
::
shared_ptr
<
Token
>
token_id
(
const
std
::
shared_ptr
<
Token
>
&
t
);
static
std
::
shared_ptr
<
Token
>
create_cpp_token
();
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/ClientInterface.java
View file @
4edf461a
...
...
@@ -5,5 +5,5 @@ package com.dropbox.djinni.test;
public
abstract
class
ClientInterface
{
/** Returns record of given string */
public
abstract
ClientReturnedRecord
getRecord
(
long
recordId
,
String
utf8string
);
public
abstract
ClientReturnedRecord
getRecord
(
long
recordId
,
String
utf8string
,
String
misc
);
}
test-suite/generated-src/java/com/dropbox/djinni/test/ClientReturnedRecord.java
View file @
4edf461a
...
...
@@ -10,11 +10,15 @@ public final class ClientReturnedRecord {
/*package*/
final
String
mContent
;
/*package*/
final
String
mMisc
;
public
ClientReturnedRecord
(
long
recordId
,
String
content
)
{
String
content
,
String
misc
)
{
this
.
mRecordId
=
recordId
;
this
.
mContent
=
content
;
this
.
mMisc
=
misc
;
}
public
long
getRecordId
()
{
...
...
@@ -24,4 +28,8 @@ public final class ClientReturnedRecord {
public
String
getContent
()
{
return
mContent
;
}
public
String
getMisc
()
{
return
mMisc
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java
View file @
4edf461a
...
...
@@ -37,6 +37,8 @@ public abstract class TestHelpers {
public
static
native
void
checkEnumMap
(
HashMap
<
Color
,
String
>
m
);
public
static
native
void
checkEnum
(
Color
c
);
public
static
native
Token
tokenId
(
Token
t
);
public
static
native
Token
createCppToken
();
...
...
test-suite/generated-src/jni/NativeClientInterface.cpp
View file @
4edf461a
...
...
@@ -3,6 +3,7 @@
#include "NativeClientInterface.hpp" // my header
#include "HI64.hpp"
#include "HOptional.hpp"
#include "HString.hpp"
#include "NativeClientReturnedRecord.hpp"
...
...
@@ -12,13 +13,14 @@ NativeClientInterface::NativeClientInterface() : djinni::JniInterface<::ClientIn
NativeClientInterface
::
JavaProxy
::
JavaProxy
(
jobject
obj
)
:
JavaProxyCacheEntry
(
obj
)
{}
::
ClientReturnedRecord
NativeClientInterface
::
JavaProxy
::
JavaProxy
::
get_record
(
int64_t
c_record_id
,
const
std
::
string
&
c_utf8string
)
{
::
ClientReturnedRecord
NativeClientInterface
::
JavaProxy
::
JavaProxy
::
get_record
(
int64_t
c_record_id
,
const
std
::
string
&
c_utf8string
,
const
std
::
experimental
::
optional
<
std
::
string
>
&
c_misc
)
{
JNIEnv
*
const
jniEnv
=
djinni
::
jniGetThreadEnv
();
djinni
::
JniLocalScope
jscope
(
jniEnv
,
10
);
jlong
j_record_id
=
::
djinni
::
HI64
::
Unboxed
::
toJava
(
jniEnv
,
c_record_id
);
djinni
::
LocalRef
<
jstring
>
j_utf8string
(
jniEnv
,
::
djinni
::
HString
::
toJava
(
jniEnv
,
c_utf8string
));
djinni
::
LocalRef
<
jstring
>
j_misc
(
jniEnv
,
::
djinni
::
HOptional
<
std
::
experimental
::
optional
,
::
djinni
::
HString
>::
toJava
(
jniEnv
,
c_misc
));
const
auto
&
data
=
djinni
::
JniClass
<::
djinni_generated
::
NativeClientInterface
>::
get
();
djinni
::
LocalRef
<
jobject
>
jret
(
jniEnv
,
jniEnv
->
CallObjectMethod
(
getGlobalRef
(),
data
.
method_getRecord
,
j_record_id
,
j_utf8string
.
get
()));
djinni
::
LocalRef
<
jobject
>
jret
(
jniEnv
,
jniEnv
->
CallObjectMethod
(
getGlobalRef
(),
data
.
method_getRecord
,
j_record_id
,
j_utf8string
.
get
()
,
j_misc
.
get
()
));
djinni
::
jniExceptionCheck
(
jniEnv
);
return
NativeClientReturnedRecord
::
fromJava
(
jniEnv
,
jret
.
get
());
};
...
...
test-suite/generated-src/jni/NativeClientInterface.hpp
View file @
4edf461a
...
...
@@ -17,12 +17,12 @@ public:
static
std
::
shared_ptr
<::
ClientInterface
>
fromJava
(
JNIEnv
*
jniEnv
,
jobject
j
)
{
return
djinni
::
JniClass
<::
djinni_generated
::
NativeClientInterface
>::
get
().
_fromJava
(
jniEnv
,
j
);
}
const
djinni
::
GlobalRef
<
jclass
>
clazz
{
djinni
::
jniFindClass
(
"com/dropbox/djinni/test/ClientInterface"
)
};
const
jmethodID
method_getRecord
{
djinni
::
jniGetMethodID
(
clazz
.
get
(),
"getRecord"
,
"(JLjava/lang/String;)Lcom/dropbox/djinni/test/ClientReturnedRecord;"
)
};
const
jmethodID
method_getRecord
{
djinni
::
jniGetMethodID
(
clazz
.
get
(),
"getRecord"
,
"(JLjava/lang/String;
Ljava/lang/String;
)Lcom/dropbox/djinni/test/ClientReturnedRecord;"
)
};
class
JavaProxy
final
:
djinni
::
JavaProxyCacheEntry
,
public
::
ClientInterface
{
public:
JavaProxy
(
jobject
obj
);
virtual
::
ClientReturnedRecord
get_record
(
int64_t
record_id
,
const
std
::
string
&
utf8string
)
override
;
virtual
::
ClientReturnedRecord
get_record
(
int64_t
record_id
,
const
std
::
string
&
utf8string
,
const
std
::
experimental
::
optional
<
std
::
string
>
&
misc
)
override
;
private:
using
djinni
::
JavaProxyCacheEntry
::
getGlobalRef
;
...
...
test-suite/generated-src/jni/NativeClientReturnedRecord.cpp
View file @
4edf461a
...
...
@@ -3,6 +3,7 @@
#include "NativeClientReturnedRecord.hpp" // my header
#include "HI64.hpp"
#include "HOptional.hpp"
#include "HString.hpp"
namespace
djinni_generated
{
...
...
@@ -10,8 +11,9 @@ namespace djinni_generated {
jobject
NativeClientReturnedRecord
::
toJava
(
JNIEnv
*
jniEnv
,
::
ClientReturnedRecord
c
)
{
jlong
j_record_id
=
::
djinni
::
HI64
::
Unboxed
::
toJava
(
jniEnv
,
c
.
record_id
);
djinni
::
LocalRef
<
jstring
>
j_content
(
jniEnv
,
::
djinni
::
HString
::
toJava
(
jniEnv
,
c
.
content
));
djinni
::
LocalRef
<
jstring
>
j_misc
(
jniEnv
,
::
djinni
::
HOptional
<
std
::
experimental
::
optional
,
::
djinni
::
HString
>::
toJava
(
jniEnv
,
c
.
misc
));
const
auto
&
data
=
djinni
::
JniClass
<::
djinni_generated
::
NativeClientReturnedRecord
>::
get
();
jobject
r
=
jniEnv
->
NewObject
(
data
.
clazz
.
get
(),
data
.
jconstructor
,
j_record_id
,
j_content
.
get
());
jobject
r
=
jniEnv
->
NewObject
(
data
.
clazz
.
get
(),
data
.
jconstructor
,
j_record_id
,
j_content
.
get
()
,
j_misc
.
get
()
);
djinni
::
jniExceptionCheck
(
jniEnv
);
return
r
;
}
...
...
@@ -21,7 +23,8 @@ jobject NativeClientReturnedRecord::toJava(JNIEnv* jniEnv, ::ClientReturnedRecor
const
auto
&
data
=
djinni
::
JniClass
<::
djinni_generated
::
NativeClientReturnedRecord
>::
get
();
return
::
ClientReturnedRecord
(
::
djinni
::
HI64
::
Unboxed
::
fromJava
(
jniEnv
,
jniEnv
->
GetLongField
(
j
,
data
.
field_mRecordId
)),
::
djinni
::
HString
::
fromJava
(
jniEnv
,
djinni
::
LocalRef
<
jstring
>
(
jniEnv
,
static_cast
<
jstring
>
(
jniEnv
->
GetObjectField
(
j
,
data
.
field_mContent
))).
get
()));
::
djinni
::
HString
::
fromJava
(
jniEnv
,
djinni
::
LocalRef
<
jstring
>
(
jniEnv
,
static_cast
<
jstring
>
(
jniEnv
->
GetObjectField
(
j
,
data
.
field_mContent
))).
get
()),
::
djinni
::
HOptional
<
std
::
experimental
::
optional
,
::
djinni
::
HString
>::
fromJava
(
jniEnv
,
djinni
::
LocalRef
<
jstring
>
(
jniEnv
,
static_cast
<
jstring
>
(
jniEnv
->
GetObjectField
(
j
,
data
.
field_mMisc
))).
get
()));
}
}
// namespace djinni_generated
test-suite/generated-src/jni/NativeClientReturnedRecord.hpp
View file @
4edf461a
...
...
@@ -17,9 +17,10 @@ public:
static
::
ClientReturnedRecord
fromJava
(
JNIEnv
*
,
jobject
);
const
djinni
::
GlobalRef
<
jclass
>
clazz
{
djinni
::
jniFindClass
(
"com/dropbox/djinni/test/ClientReturnedRecord"
)
};
const
jmethodID
jconstructor
{
djinni
::
jniGetMethodID
(
clazz
.
get
(),
"<init>"
,
"(JLjava/lang/String;)V"
)
};
const
jmethodID
jconstructor
{
djinni
::
jniGetMethodID
(
clazz
.
get
(),
"<init>"
,
"(JLjava/lang/String;
Ljava/lang/String;
)V"
)
};
const
jfieldID
field_mRecordId
{
djinni
::
jniGetFieldID
(
clazz
.
get
(),
"mRecordId"
,
"J"
)
};
const
jfieldID
field_mContent
{
djinni
::
jniGetFieldID
(
clazz
.
get
(),
"mContent"
,
"Ljava/lang/String;"
)
};
const
jfieldID
field_mMisc
{
djinni
::
jniGetFieldID
(
clazz
.
get
(),
"mMisc"
,
"Ljava/lang/String;"
)
};
private:
NativeClientReturnedRecord
()
{}
...
...
test-suite/generated-src/jni/NativeTestHelpers.cpp
View file @
4edf461a
...
...
@@ -199,6 +199,16 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEnumMap(JN
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
)
}
CJNIEXPORT
void
JNICALL
Java_com_dropbox_djinni_test_TestHelpers_checkEnum
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jobject
j_c
)
{
try
{
DJINNI_FUNCTION_PROLOGUE0
(
jniEnv
);
::
color
c_c
=
NativeColor
::
fromJava
(
jniEnv
,
j_c
);
::
TestHelpers
::
check_enum
(
c_c
);
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
)
}
CJNIEXPORT
jobject
JNICALL
Java_com_dropbox_djinni_test_TestHelpers_tokenId
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jobject
j_t
)
{
try
{
...
...
test-suite/generated-src/objc/DBClientInterface.h
View file @
4edf461a
...
...
@@ -9,6 +9,7 @@
/** Returns record of given string */
-
(
DBClientReturnedRecord
*
)
getRecord
:(
int64_t
)
recordId
utf8string
:(
NSString
*
)
utf8string
;
utf8string
:(
NSString
*
)
utf8string
misc
:(
NSString
*
)
misc
;
@end
test-suite/generated-src/objc/DBClientInterface.mm
View file @
4edf461a
...
...
@@ -18,11 +18,12 @@ class ClientInterface::ObjcProxy final
{
public:
using
Handle
::
Handle
;
::
ClientReturnedRecord
get_record
(
int64_t
record_id
,
const
std
::
string
&
utf8string
)
override
::
ClientReturnedRecord
get_record
(
int64_t
record_id
,
const
std
::
string
&
utf8string
,
const
std
::
experimental
::
optional
<
std
::
string
>
&
misc
)
override
{
@autoreleasepool
{
auto
r
=
[
Handle
:
:
get
()
getRecord
:(
::
djinni
::
I64
::
fromCpp
(
record_id
))
utf8string:
(
::
djinni
::
String
::
fromCpp
(
utf8string
))];
utf8string:
(
::
djinni
::
String
::
fromCpp
(
utf8string
))
misc:
(
::
djinni
::
Optional
<
std
::
experimental
::
optional
,
::
djinni
::
String
>::
fromCpp
(
misc
))];
return
::
djinni_generated
::
ClientReturnedRecord
::
toCpp
(
r
);
}
}
...
...
test-suite/generated-src/objc/DBClientReturnedRecord+Private.mm
View file @
4edf461a
...
...
@@ -15,13 +15,15 @@ auto ClientReturnedRecord::toCpp(ObjcType obj) -> CppType
{
assert
(
obj
);
return
{
::
djinni
::
I64
::
toCpp
(
obj
.
recordId
),
::
djinni
::
String
::
toCpp
(
obj
.
content
)};
::
djinni
::
String
::
toCpp
(
obj
.
content
),
::
djinni
::
Optional
<
std
::
experimental
::
optional
,
::
djinni
::
String
>::
toCpp
(
obj
.
misc
)};
}
auto
ClientReturnedRecord
::
fromCpp
(
const
CppType
&
cpp
)
->
ObjcType
{
return
[[
DBClientReturnedRecord
alloc
]
initWithRecordId
:(
::
djinni
:
:
I64
::
fromCpp
(
cpp
.
record_id
))
content:
(
::
djinni
::
String
::
fromCpp
(
cpp
.
content
))];
content:
(
::
djinni
::
String
::
fromCpp
(
cpp
.
content
))
misc:
(
::
djinni
::
Optional
<
std
::
experimental
::
optional
,
::
djinni
::
String
>::
fromCpp
(
cpp
.
misc
))];
}
}
// namespace djinni_generated
test-suite/generated-src/objc/DBClientReturnedRecord.h
View file @
4edf461a
...
...
@@ -6,10 +6,13 @@
@interface
DBClientReturnedRecord
:
NSObject
-
(
id
)
initWithClientReturnedRecord
:(
DBClientReturnedRecord
*
)
clientReturnedRecord
;
-
(
id
)
initWithRecordId
:(
int64_t
)
recordId
content
:(
NSString
*
)
content
;
content
:(
NSString
*
)
content
misc
:(
NSString
*
)
misc
;
@property
(
nonatomic
,
readonly
)
int64_t
recordId
;
@property
(
nonatomic
,
readonly
)
NSString
*
content
;
@property
(
nonatomic
,
readonly
)
NSString
*
misc
;
@end
test-suite/generated-src/objc/DBClientReturnedRecord.mm
View file @
4edf461a
...
...
@@ -11,16 +11,23 @@
if
(
self
=
[
super
init
])
{
_recordId
=
clientReturnedRecord
.
recordId
;
_content
=
[
clientReturnedRecord
.
content
copy
];
if
(
clientReturnedRecord
.
misc
==
nil
)
{
_misc
=
nil
;
}
else
{
_misc
=
[
clientReturnedRecord
.
misc
copy
];
}
}
return
self
;
}
-
(
id
)
initWithRecordId
:(
int64_t
)
recordId
content
:(
NSString
*
)
content
misc
:(
NSString
*
)
misc
{
if
(
self
=
[
super
init
])
{
_recordId
=
recordId
;
_content
=
[
content
copy
];
_misc
=
[
misc
copy
];
}
return
self
;
}
...
...
test-suite/generated-src/objc/DBTestHelpers.h
View file @
4edf461a
...
...
@@ -44,6 +44,8 @@
+
(
void
)
checkEnumMap
:(
NSDictionary
*
)
m
;
+
(
void
)
checkEnum
:(
DBColor
)
c
;
+
(
DBToken
*
)
tokenId
:(
DBToken
*
)
t
;
+
(
DBToken
*
)
createCppToken
;
...
...
test-suite/generated-src/objc/DBTestHelpers.mm
View file @
4edf461a
...
...
@@ -157,6 +157,12 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
void
)
checkEnum
:(
DBColor
)
c
{
try
{
::
TestHelpers
::
check_enum
(
::
djinni
::
Enum
<::
color
,
DBColor
>::
toCpp
(
c
));
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBToken
*
)
tokenId
:(
DBToken
*
)
t
{
try
{
auto
r
=
::
TestHelpers
::
token_id
(
::
djinni_generated
::
Token
::
toCpp
(
t
));
...
...
test-suite/handwritten-src/cpp/test_helpers.cpp
View file @
4edf461a
...
...
@@ -71,7 +71,7 @@ static const std::string HELLO_WORLD = "Hello World!";
static
const
std
::
string
NON_ASCII
=
"Non-ASCII / 非 ASCII 字符"
;
void
TestHelpers
::
check_client_interface_ascii
(
const
std
::
shared_ptr
<
ClientInterface
>
&
i
)
{
ClientReturnedRecord
cReturnedRecord
=
i
->
get_record
(
5
,
HELLO_WORLD
);
ClientReturnedRecord
cReturnedRecord
=
i
->
get_record
(
5
,
HELLO_WORLD
,
{}
);
if
(
cReturnedRecord
.
content
!=
HELLO_WORLD
)
{
std
::
string
error_msg
=
"Expected String: "
+
HELLO_WORLD
+
" Actual: "
+
cReturnedRecord
.
content
;
throw
std
::
invalid_argument
(
error_msg
);
...
...
@@ -79,7 +79,7 @@ void TestHelpers::check_client_interface_ascii(const std::shared_ptr<ClientInter
}
void
TestHelpers
::
check_client_interface_nonascii
(
const
std
::
shared_ptr
<
ClientInterface
>
&
i
)
{
ClientReturnedRecord
cReturnedRecord
=
i
->
get_record
(
5
,
NON_ASCII
);
ClientReturnedRecord
cReturnedRecord
=
i
->
get_record
(
5
,
NON_ASCII
,
{}
);
if
(
cReturnedRecord
.
content
!=
NON_ASCII
)
{
std
::
string
error_msg
=
"Expected String: "
+
NON_ASCII
+
" Actual: "
+
cReturnedRecord
.
content
;
throw
std
::
invalid_argument
(
error_msg
);
...
...
@@ -125,6 +125,8 @@ void TestHelpers::check_enum_map(const std::unordered_map<color, std::string> &
}
}
void
TestHelpers
::
check_enum
(
color
)
{}
// stub
AssortedIntegers
TestHelpers
::
assorted_integers_id
(
const
AssortedIntegers
&
i
)
{
return
i
;
}
test-suite/handwritten-src/java/com/dropbox/djinni/test/ClientInterfaceImpl.java
View file @
4edf461a
...
...
@@ -4,10 +4,10 @@ import static junit.framework.Assert.assertTrue;
public
class
ClientInterfaceImpl
extends
ClientInterface
{
@Override
public
ClientReturnedRecord
getRecord
(
long
id
,
String
utf8string
)
{
public
ClientReturnedRecord
getRecord
(
long
id
,
String
utf8string
,
String
misc
)
{
if
(!
utf8string
.
equals
(
"Non-ASCII / 非 ASCII 字符"
)
&&
!
utf8string
.
equals
(
"Hello World!"
))
{
throw
new
RuntimeException
(
"Unexpected string. Check UTF-8?"
);
}
return
new
ClientReturnedRecord
(
id
,
utf8string
);
return
new
ClientReturnedRecord
(
id
,
utf8string
,
misc
);
}
}
test-suite/handwritten-src/objc/impl/DBClientInterfaceImpl.mm
View file @
4edf461a
...
...
@@ -6,10 +6,10 @@ static NSString *DBNonAscii = @"Non-ASCII / 非 ASCII 字符";
@implementation
DBClientInterfaceImpl
-
(
DBClientReturnedRecord
*
)
getRecord
:(
int64_t
)
ident
utf8string
:(
NSString
*
)
utf8string
-
(
DBClientReturnedRecord
*
)
getRecord
:(
int64_t
)
ident
utf8string
:(
NSString
*
)
utf8string
misc
:(
NSString
*
)
misc
{
NSAssert
([
utf8string
isEqualToString
:
DBHelloWorld
]
||
[
utf8string
isEqualToString
:
DBNonAscii
],
@"Unexpected String"
);
return
[[
DBClientReturnedRecord
alloc
]
initWithRecordId
:
ident
content
:
utf8string
];
return
[[
DBClientReturnedRecord
alloc
]
initWithRecordId
:
ident
content
:
utf8string
misc
:
misc
];
}
@end
test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj
View file @
4edf461a
...
...
@@ -662,7 +662,7 @@
DSTROOT
=
/tmp/DjinniObjcTest.dst
;
GCC_PRECOMPILE_PREFIX_HEADER
=
NO
;
OTHER_CPLUSPLUSFLAGS
=
(
"-std=c++1
y
"
,
"-std=c++1
4
"
,
"$(OTHER_CFLAGS)"
,
);
OTHER_LDFLAGS
=
"-ObjC"
;
...
...
@@ -683,7 +683,7 @@
DSTROOT
=
/tmp/DjinniObjcTest.dst
;
GCC_PRECOMPILE_PREFIX_HEADER
=
NO
;
OTHER_CPLUSPLUSFLAGS
=
(
"-std=c++1
y
"
,
"-std=c++1
4
"
,
"$(OTHER_CFLAGS)"
,
);
OTHER_LDFLAGS
=
"-ObjC"
;
...
...
@@ -700,6 +700,7 @@
65868B711989FE4200D60EEE
/* Debug */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
CLANG_CXX_LANGUAGE_STANDARD
=
"c++14"
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(SDKROOT)/Developer/Library/Frameworks"
,
"$(inherited)"
,
...
...
@@ -724,6 +725,7 @@
65868B721989FE4200D60EEE
/* Release */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
CLANG_CXX_LANGUAGE_STANDARD
=
"c++14"
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(SDKROOT)/Developer/Library/Frameworks"
,
"$(inherited)"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment