Skip to content

Commit

Permalink
add non-generic valuetype ldflda test
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdageek committed Jun 14, 2023
1 parent e895946 commit b7c52f7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ public double FireEvents() {

return Accumulator;
}

public DateTime GetDateTime() => default(DateTime);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public double FireEvents() {
return Accumulator;
}

public DateTime GetDateTime() => default(DateTime);

public double AddedFirstProp {get => 0.0; set { Console.WriteLine (value); } }

public DateTime AddedDateTime;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ public double FireEvents() {
return Accumulator;
}

public DateTime GetDateTime() => AddedDateTime;

public double AddedFirstProp {get => 0.0; set { Console.WriteLine (value+value); } }
public short AddedSecondProp {get; set; }

public DateTime AddedDateTime;

}
}
7 changes: 7 additions & 0 deletions src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ public static void TestAddInstanceField()
Assert.True ((addedEventToken & 0x00ffffff) < 4);
fi = x2.GetType().GetField("AddedDateTime");
Assert.NotNull(fi);
var dt = DateTime.Now;
fi.SetValue(x2, dt);
Assert.Equal(dt, fi.GetValue(x2));
ApplyUpdateUtil.ApplyUpdate(assm);
Expand All @@ -419,6 +424,8 @@ public static void TestAddInstanceField()
var secondPropGetter = addedSecondPropInfo.GetGetMethod();
Assert.NotNull (secondPropGetter);
Assert.Equal(dt, x2.GetDateTime());
});
}

Expand Down

0 comments on commit b7c52f7

Please sign in to comment.