Skip to content

Commit

Permalink
Print message with timestamp to see what the hell is the GA filesyste…
Browse files Browse the repository at this point in the history
…m doing
  • Loading branch information
exyi committed Nov 29, 2024
1 parent c732af6 commit 85e9471
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Tests/Runtime/MarkupLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,28 @@ public void FileReloading(bool debug)
var directory = MakeTempDir();
var file = Path.Combine(directory, "test.dotcontrol");
File.WriteAllText(file, "@viewModel string\n\n<dot:TextBox Text=Initial />");
var changedTime1 = File.GetLastWriteTimeUtc(file);

var config = debug ? DotvvmTestHelper.DebugConfig : DotvvmTestHelper.DefaultConfig;

var controlBuilder = config.ServiceProvider.GetRequiredService<IControlBuilderFactory>();
var builder0 = controlBuilder.GetControlBuilder(file);
Assert.AreEqual(typeof(string), builder0.descriptor.DataContextType);

var builderUnchanged = controlBuilder.GetControlBuilder(file);

Assert.AreSame(builder0.builder, builderUnchanged.builder); // same Lazy instance

File.WriteAllText(file, "@viewModel int\n\n<dot:TextBox Text=Changed />");
Thread.Sleep(1000);

var builderChanged = controlBuilder.GetControlBuilder(file);
var control = builderChanged.builder.Value.BuildControl(config.ServiceProvider.GetRequiredService<IControlBuilderFactory>(), config.ServiceProvider);
if (debug)
{
var changedTime2 = File.GetLastWriteTimeUtc(file);
if (changedTime1 == changedTime2)
Assert.Fail($"File system resolution is probably too low ({changedTime1:o} == {changedTime2:o}), ignores changes or something.");

Check failure on line 84 in src/Tests/Runtime/MarkupLoaderTests.cs

View workflow job for this annotation

GitHub Actions / .NET unit tests (windows-2022)

FileReloading (True)

Assert.Fail failed. File system resolution is probably too low (2024-11-29T16:22:57.2569233Z == 2024-11-29T16:22:57.2569233Z), ignores changes or something.

Assert.AreEqual(typeof(int), builderChanged.descriptor.DataContextType);
Assert.AreNotSame(builder0.builder, builderChanged.builder); // different Lazy instance
XAssert.Equal(["Changed"], control.GetThisAndAllDescendants().OfType<TextBox>().Select(c => c.Text));
Expand Down

0 comments on commit 85e9471

Please sign in to comment.