Skip to content

Commit 2d08ea2

Browse files
committed
Fix unit tests.
1 parent c8380ae commit 2d08ea2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/generator_tests.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('Generator Tests', () => {
5757
chai.expect(output).contains('public func getClaimableBalances() -> [UInt8] {');
5858
chai.expect(output).contains('internal func free() {');
5959

60-
chai.expect(output).contains('let chainSourceOption = Option_FilterZ(some: chainSource)');
60+
chai.expect(output).contains('let chainSourceOption = Option_FilterZ(some: chainSource, instantiationContext: "');
6161
chai.expect(output).contains('let nativeCallResult = ChainMonitor_free(self.cType!)');
6262
});
6363

@@ -105,7 +105,7 @@ describe('Generator Tests', () => {
105105
const generator = new VectorGenerator(config, new AuxiliaryArtifacts());
106106
const vectorVectorOutput = generator.generateFileContents(routeVectorVector);
107107

108-
chai.expect(vectorVectorOutput).includes('public init(array: [[RouteHop]]) {');
108+
chai.expect(vectorVectorOutput).includes('internal init(array: [[RouteHop]], instantiationContext: String) {');
109109
chai.expect(vectorVectorOutput)
110110
.includes('let dataContainer = UnsafeMutablePointer<LDKCVec_RouteHopZ>.allocate(capacity: array.count)');
111111
chai.expect(vectorVectorOutput)
@@ -123,11 +123,11 @@ describe('Generator Tests', () => {
123123
chai.expect(vectorVectorOutput)
124124
.includes('let swiftArray = array.map { (currentCType: [LDKRouteHop]) -> [RouteHop] in');
125125
chai.expect(vectorVectorOutput).includes('currentCType.map { (currentCType: LDKRouteHop) -> RouteHop in');
126-
chai.expect(vectorVectorOutput).includes('RouteHop(cType: currentCType, anchor: self).dangle()');
126+
chai.expect(vectorVectorOutput).includes('RouteHop(cType: currentCType, instantiationContext: "#{swift_class_name}::\\(#function):\\(#line)", anchor: self).dangle()');
127127

128128
const routeVector = <RustVector>glossary['LDKCVec_RouteHopZ'];
129129
const vectorOutput = generator.generateFileContents(routeVector);
130-
chai.expect(vectorOutput).includes('public init(array: [RouteHop]) {');
130+
chai.expect(vectorOutput).includes('internal init(array: [RouteHop], instantiationContext: String) {');
131131
chai.expect(vectorOutput)
132132
.includes('let rustArray = array.map { (currentValueDepth1: RouteHop) -> LDKRouteHop in');
133133
chai.expect(vectorOutput).includes('return currentValueDepth1.cType!');
@@ -140,7 +140,7 @@ describe('Generator Tests', () => {
140140
chai.expect(vectorOutput).includes('var array = [LDKRouteHop]()');
141141
chai.expect(vectorOutput)
142142
.includes('let swiftArray = array.map { (currentCType: LDKRouteHop) -> RouteHop in');
143-
chai.expect(vectorOutput).includes('RouteHop(cType: currentCType, anchor: self).dangle()');
143+
chai.expect(vectorOutput).includes('RouteHop(cType: currentCType, instantiationContext: "#{swift_class_name}::\\(#function):\\(#line)", anchor: self).dangle()');
144144
});
145145

146146
it('should generate Vec<u8>', () => {
@@ -155,7 +155,7 @@ describe('Generator Tests', () => {
155155
const generator = new VectorGenerator(config, new AuxiliaryArtifacts());
156156
const output = generator.generateFileContents(routeVectorVector);
157157

158-
chai.expect(output).includes('public init(array: [UInt8]) {');
158+
chai.expect(output).includes('internal init(array: [UInt8], instantiationContext: String) {');
159159
chai.expect(output)
160160
.includes('let dataContainer = UnsafeMutablePointer<UInt8>.allocate(capacity: array.count)');
161161
chai.expect(output).includes('dataContainer.initialize(from: array, count: array.count)');
@@ -260,27 +260,27 @@ describe('Generator Tests', () => {
260260
const strOutput = generator.generateFileContents(ldkStr);
261261
const u5Output = generator.generateFileContents(ldku5);
262262

263-
chai.expect(transactionOutput).includes('public init(value: [UInt8]) {');
263+
chai.expect(transactionOutput).includes('internal init(value: [UInt8], instantiationContext: String) {');
264264
chai.expect(transactionOutput).includes('public func getValue() -> [UInt8] {');
265265
chai.expect(transactionOutput)
266266
.includes('self.cType = LDKTransaction(data: dataContainer, datalen: UInt(value.count), data_is_owned: true)');
267267

268-
chai.expect(thirtyTwoBytesOutput).includes('public init(value: [UInt8]) {');
268+
chai.expect(thirtyTwoBytesOutput).includes('internal init(value: [UInt8], instantiationContext: String) {');
269269
chai.expect(thirtyTwoBytesOutput).includes('public func getValue() -> [UInt8] {');
270270
chai.expect(thirtyTwoBytesOutput)
271271
.includes('self.cType = LDKThirtyTwoBytes(data: Bindings.arrayToUInt8Tuple32(array: value))');
272272

273273
chai.expect(thirtyTwoBytesOutput)
274274
.includes('return Bindings.UInt8Tuple32ToArray(tuple: self.cType!.data)');
275275

276-
chai.expect(strOutput).includes('public init(value: String) {');
276+
chai.expect(strOutput).includes('internal init(value: String, instantiationContext: String) {');
277277
chai.expect(strOutput).includes('public func getValue() -> String {');
278278
chai.expect(strOutput)
279279
.includes('self.cType = LDKStr(chars: Bindings.string_to_unsafe_uint8_pointer(string: value), len: UInt(value.count), chars_is_owned: true)');
280280

281281
chai.expect(strOutput).includes('return String(data: data, encoding: .utf8)!');
282282

283-
chai.expect(u5Output).includes('public init(value: UInt8) {');
283+
chai.expect(u5Output).includes('internal init(value: UInt8, instantiationContext: String) {');
284284
chai.expect(u5Output).includes('public func getValue() -> UInt8 {');
285285
chai.expect(u5Output).includes('self.cType = LDKU5(_0: value)');
286286
chai.expect(u5Output).includes('return self.cType!._0');

0 commit comments

Comments
 (0)